View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.ldap.handlers.sasl;
21  
22  
23  import javax.security.sasl.SaslException;
24  import javax.security.sasl.SaslServer;
25  
26  import org.apache.directory.api.ldap.model.message.BindRequest;
27  import org.apache.directory.api.util.StringConstants;
28  import org.apache.directory.api.util.Strings;
29  import org.apache.directory.server.core.api.CoreSession;
30  import org.apache.directory.server.ldap.LdapSession;
31  
32  
33  /**
34   * An abstract class containing common parts for the SaslServer local 
35   * implementation, like the BindRequest;
36   *
37   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
38   */
39  public abstract class AbstractSaslServer implements SaslServer
40  {
41      /** The associated BindRequest */
42      private final BindRequest bindRequest;
43  
44      /** The associated LdapSession instance */
45      private final LdapSession ldapSession;
46  
47      /** The admin session, used to authenticate users against the LDAP server */
48      private CoreSession adminSession;
49  
50  
51      public AbstractSaslServer( LdapSession ldapSession, CoreSession adminSession, BindRequest bindRequest )
52      {
53          this.bindRequest = bindRequest;
54          this.ldapSession = ldapSession;
55          this.adminSession = adminSession;
56      }
57  
58  
59      /**
60       * {@inheritDoc}
61       * 
62       * NOT IMPLEMENTED
63       */
64      public byte[] unwrap( byte[] incoming, int offset, int len ) throws SaslException
65      {
66          return StringConstants.EMPTY_BYTES;
67      }
68  
69  
70      /**
71       * {@inheritDoc}
72       * 
73       * NOT IMPLEMENTED
74       */
75      public byte[] wrap( byte[] outgoing, int offset, int len ) throws SaslException
76      {
77          return Strings.EMPTY_BYTES;
78      }
79  
80  
81      /**
82       *  @return the associated BindRequest object
83       */
84      public BindRequest getBindRequest()
85      {
86          return bindRequest;
87      }
88  
89  
90      /**
91       *  @return the associated ioSession
92       */
93      public LdapSession getLdapSession()
94      {
95          return ldapSession;
96      }
97  
98  
99      /**
100      *  @return the admin Session
101      */
102     public CoreSession getAdminSession()
103     {
104         return adminSession;
105     }
106 
107 
108     /**
109      * {@inheritDoc}
110      */
111     public String getAuthorizationID()
112     {
113         return "";
114     }
115 
116 
117     /**
118      * {@inheritDoc}
119      */
120     public Object getNegotiatedProperty( String propName )
121     {
122         return "";
123     }
124 
125 
126     /**
127      * {@inheritDoc}
128      */
129     public void dispose() throws SaslException
130     {
131     }
132 }