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 */ 020package org.apache.directory.server.ldap.handlers.sasl; 021 022 023import javax.security.sasl.SaslException; 024import javax.security.sasl.SaslServer; 025 026import org.apache.directory.api.ldap.model.message.BindRequest; 027import org.apache.directory.api.util.Strings; 028import org.apache.directory.server.core.api.CoreSession; 029import org.apache.directory.server.ldap.LdapSession; 030 031 032/** 033 * An abstract class containing common parts for the SaslServer local 034 * implementation, like the BindRequest; 035 * 036 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 037 */ 038public abstract class AbstractSaslServer implements SaslServer 039{ 040 /** The associated BindRequest */ 041 private final BindRequest 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, BindRequest 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 Strings.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 Strings.EMPTY_BYTES; 077 } 078 079 080 /** 081 * @return the associated BindRequest object 082 */ 083 public BindRequest 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}