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.Strings;
28  import org.apache.directory.server.core.api.CoreSession;
29  import org.apache.directory.server.ldap.LdapSession;
30  
31  
32  /**
33   * An abstract class containing common parts for the SaslServer local 
34   * implementation, like the BindRequest;
35   *
36   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
37   */
38  public abstract class AbstractSaslServer implements SaslServer
39  {
40      /** The associated BindRequest */
41      private final BindRequest bindRequest;
42  
43      /** The associated LdapSession instance */
44      private final LdapSession ldapSession;
45  
46      /** The admin session, used to authenticate users against the LDAP server */
47      private CoreSession adminSession;
48  
49  
50      public AbstractSaslServer( LdapSession ldapSession, CoreSession adminSession, BindRequest bindRequest )
51      {
52          this.bindRequest = bindRequest;
53          this.ldapSession = ldapSession;
54          this.adminSession = adminSession;
55      }
56  
57  
58      /**
59       * {@inheritDoc}
60       * 
61       * NOT IMPLEMENTED
62       */
63      public byte[] unwrap( byte[] incoming, int offset, int len ) throws SaslException
64      {
65          return Strings.EMPTY_BYTES;
66      }
67  
68  
69      /**
70       * {@inheritDoc}
71       * 
72       * NOT IMPLEMENTED
73       */
74      public byte[] wrap( byte[] outgoing, int offset, int len ) throws SaslException
75      {
76          return Strings.EMPTY_BYTES;
77      }
78  
79  
80      /**
81       *  @return the associated BindRequest object
82       */
83      public BindRequest getBindRequest()
84      {
85          return bindRequest;
86      }
87  
88  
89      /**
90       *  @return the associated ioSession
91       */
92      public LdapSession getLdapSession()
93      {
94          return ldapSession;
95      }
96  
97  
98      /**
99       *  @return the admin Session
100      */
101     public CoreSession getAdminSession()
102     {
103         return adminSession;
104     }
105 
106 
107     /**
108      * {@inheritDoc}
109      */
110     public String getAuthorizationID()
111     {
112         return "";
113     }
114 
115 
116     /**
117      * {@inheritDoc}
118      */
119     public Object getNegotiatedProperty( String propName )
120     {
121         return "";
122     }
123 
124 
125     /**
126      * {@inheritDoc}
127      */
128     public void dispose() throws SaslException
129     {
130     }
131 }