001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 package org.apache.directory.server.ldap.handlers.bind; 021 022 import javax.security.sasl.SaslException; 023 import javax.security.sasl.SaslServer; 024 025 import org.apache.directory.server.core.CoreSession; 026 import org.apache.directory.server.ldap.LdapSession; 027 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest; 028 import org.apache.directory.shared.ldap.util.StringTools; 029 030 031 /** 032 * An abstract class containing common parts for the SaslServer local 033 * implementation, like the BindRequest; 034 * 035 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 036 * @version $Rev$, $Date$ 037 */ 038 public abstract class AbstractSaslServer implements SaslServer 039 { 040 /** The associated BindRequest */ 041 private final InternalBindRequest bindRequest; 042 043 /** The associated LdapSession instance */ 044 private final LdapSession ldapSession; 045 046 /** The admin session, used to authenticate users against the LDAP server */ 047 private CoreSession adminSession; 048 049 050 public AbstractSaslServer( LdapSession ldapSession, CoreSession adminSession, InternalBindRequest bindRequest ) 051 { 052 this.bindRequest = bindRequest; 053 this.ldapSession = ldapSession; 054 this.adminSession = adminSession; 055 } 056 057 058 /** 059 * {@inheritDoc} 060 * 061 * NOT IMPLEMENTED 062 */ 063 public byte[] unwrap( byte[] incoming, int offset, int len ) throws SaslException 064 { 065 return StringTools.EMPTY_BYTES; 066 } 067 068 069 /** 070 * {@inheritDoc} 071 * 072 * NOT IMPLEMENTED 073 */ 074 public byte[] wrap( byte[] outgoing, int offset, int len ) throws SaslException 075 { 076 return new byte[0]; 077 } 078 079 080 /** 081 * @return the associated BindRequest object 082 */ 083 public InternalBindRequest getBindRequest() 084 { 085 return bindRequest; 086 } 087 088 089 /** 090 * @return the associated ioSession 091 */ 092 public LdapSession getLdapSession() 093 { 094 return ldapSession; 095 } 096 097 098 /** 099 * @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 }