public abstract class DirBasedAuthentication extends java.lang.Object implements IAuthManager, IExtendedPluginInfo
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
DEFAULT_DNPATTERN |
protected java.lang.String |
mBaseDN |
protected boolean |
mBoundConnEnable |
protected IConfigStore |
mConfig |
protected ILdapConnFactory |
mConnFactory |
protected static java.util.Vector<java.lang.String> |
mExtendedPluginInfo |
protected java.lang.String |
mGroupObjectClass |
protected java.lang.String |
mGroups |
protected java.lang.String |
mGroupsBaseDN |
protected boolean |
mGroupsEnable |
protected java.lang.String |
mGroupUserIDName |
protected java.lang.String |
mImplName |
protected java.lang.String[] |
mLdapAttrs |
protected java.lang.String[] |
mLdapByteAttrs |
protected IConfigStore |
mLdapConfig |
protected java.lang.String[] |
mLdapStringAttrs |
protected ILogger |
mLogger |
protected java.lang.String |
mName |
protected DNPattern |
mPattern |
protected boolean |
mSearchGroupUserByUserdn |
protected java.lang.String |
mTag |
protected java.lang.String |
mUserIDName |
protected static java.lang.String |
PROP_BASEDN |
protected static java.lang.String |
PROP_DNPATTERN |
protected static java.lang.String |
PROP_GROUP_OBJECT_CLASS |
protected static java.lang.String |
PROP_GROUP_USERID_NAME |
protected static java.lang.String |
PROP_GROUPS |
protected static java.lang.String |
PROP_GROUPS_BASEDN |
protected static java.lang.String |
PROP_GROUPS_ENABLE |
protected static java.lang.String |
PROP_LDAP |
protected static java.lang.String |
PROP_LDAP_BOUND_CONN |
protected static java.lang.String |
PROP_LDAP_BOUND_TAG |
protected static java.lang.String |
PROP_LDAPBYTEATTRS |
protected static java.lang.String |
PROP_LDAPSTRINGATTRS |
protected static java.lang.String |
PROP_SEARCH_GROUP_USER_BY_USERDN |
protected static java.lang.String |
PROP_USERID_NAME |
protected static java.lang.String |
USER_DN |
CRED_CERT_SERIAL_TO_REVOKE, CRED_HOST_NAME, CRED_SESSION_ID, CRED_SSL_CLIENT_CERTHELP_TEXT, HELP_TOKEN| Constructor and Description |
|---|
DirBasedAuthentication()
Default constructor, initialization must follow.
|
| Modifier and Type | Method and Description |
|---|---|
IAuthToken |
authenticate(IAuthCredentials authCred)
Authenticates user through LDAP by a set of credentials.
|
protected abstract java.lang.String |
authenticate(netscape.ldap.LDAPConnection conn,
IAuthCredentials authCreds,
AuthToken token)
Authenticates a user through directory based a set of credentials.
|
protected void |
formCertInfo(netscape.ldap.LDAPConnection conn,
java.lang.String userdn,
netscape.security.x509.X509CertInfo certinfo,
AuthToken token)
Formulate the cert info.
|
protected java.lang.String |
formSubjectName(netscape.ldap.LDAPEntry entry)
Formulate the subject name
|
abstract java.lang.String[] |
getConfigParams()
Returns a list of configuration parameter names.
|
IConfigStore |
getConfigStore()
Gets the configuration substore used by this authentication manager
|
java.lang.String[] |
getExtendedPluginInfo(java.util.Locale locale)
This method returns an array of strings.
|
java.lang.String |
getImplName()
gets the plugin name of this authentication manager.
|
protected java.lang.String[] |
getLdapAttrs()
Return a list of LDAP attributes with String values to retrieve.
|
protected java.lang.String[] |
getLdapByteAttrs()
Return a list of LDAP attributes with byte[] values to retrieve.
|
java.lang.String |
getName()
gets the name of this authentication manager instance
|
abstract java.lang.String[] |
getRequiredCreds()
get the list of required credentials.
|
void |
init(java.lang.String name,
java.lang.String implName,
IConfigStore config)
Initializes the UidPwdDirBasedAuthentication auth manager.
|
void |
init(java.lang.String name,
java.lang.String implName,
IConfigStore config,
boolean needBaseDN) |
protected void |
log(int level,
java.lang.String msg)
Logs a message for this class in the system log file.
|
protected void |
setAuthTokenByteValue(java.lang.String name,
netscape.ldap.LDAPEntry entry,
AuthToken tok) |
protected void |
setAuthTokenStringValue(java.lang.String name,
netscape.ldap.LDAPEntry entry,
AuthToken tok) |
protected void |
setAuthTokenValues(netscape.ldap.LDAPEntry e,
AuthToken tok)
Copy values from the LDAPEntry into the AuthToken.
|
void |
shutdown()
disconnects the ldap connections
|
protected static final java.lang.String USER_DN
protected static final java.lang.String PROP_LDAP
protected static final java.lang.String PROP_BASEDN
protected static final java.lang.String PROP_GROUPS_ENABLE
protected static final java.lang.String PROP_GROUPS_BASEDN
protected static final java.lang.String PROP_GROUPS
protected static final java.lang.String PROP_GROUP_OBJECT_CLASS
protected static final java.lang.String PROP_GROUP_USERID_NAME
protected static final java.lang.String PROP_USERID_NAME
protected static final java.lang.String PROP_SEARCH_GROUP_USER_BY_USERDN
protected static final java.lang.String PROP_DNPATTERN
protected static final java.lang.String PROP_LDAPSTRINGATTRS
protected static final java.lang.String PROP_LDAPBYTEATTRS
protected static final java.lang.String PROP_LDAP_BOUND_CONN
protected static final java.lang.String PROP_LDAP_BOUND_TAG
protected java.lang.String mName
protected java.lang.String mImplName
protected IConfigStore mConfig
protected IConfigStore mLdapConfig
protected java.lang.String mBaseDN
protected boolean mGroupsEnable
protected java.lang.String mGroups
protected java.lang.String mGroupsBaseDN
protected java.lang.String mGroupObjectClass
protected java.lang.String mUserIDName
protected java.lang.String mGroupUserIDName
protected boolean mSearchGroupUserByUserdn
protected boolean mBoundConnEnable
protected ILdapConnFactory mConnFactory
protected ILogger mLogger
protected DNPattern mPattern
protected java.lang.String[] mLdapStringAttrs
protected java.lang.String[] mLdapByteAttrs
protected java.lang.String[] mLdapAttrs
protected java.lang.String mTag
protected static java.lang.String DEFAULT_DNPATTERN
protected static java.util.Vector<java.lang.String> mExtendedPluginInfo
public DirBasedAuthentication()
public void init(java.lang.String name,
java.lang.String implName,
IConfigStore config)
throws EBaseException
ldap.basedn - the ldap base dn.
ldap.ldapconn.host - the ldap host.
ldap.ldapconn.port - the ldap port
ldap.ldapconn.secureConn - whether port should be secure
ldap.minConns - minimum connections
ldap.maxConns - max connections
dnpattern - dn pattern.
dnpattern is a string representing a subject name pattern to formulate from the directory attributes and entry dn. If empty or not set, the ldap entry DN will be used as the certificate subject name.
The syntax is
dnpattern = SubjectNameComp *[ "," SubjectNameComp ]
SubjectNameComponent = DnComp | EntryComp | ConstantComp
DnComp = CertAttr "=" "$dn" "." DnAttr "." Num
EntryComp = CertAttr "=" "$attr" "." EntryAttr "." Num
ConstantComp = CertAttr "=" Constant
DnAttr = an attribute in the Ldap entry dn
EntryAttr = an attribute in the Ldap entry
CertAttr = a Component in the Certificate Subject Name
(multiple AVA in one RDN not supported)
Num = the nth value of tha attribute in the dn or entry.
Constant = Constant String, with any accepted ldap string value.
Example:
dnpattern:
E=$attr.mail.1, CN=$attr.cn, OU=$attr.ou.2, O=$dn.o, C=US
Ldap entry dn:
UID=joesmith, OU=people, O=Acme.com
Ldap attributes:
cn: Joe Smith
sn: Smith
mail: joesmith@acme.com
mail: joesmith@redhat.com
ou: people
ou: IS
etc.
The subject name formulated in the cert will be :
E=joesmith@acme.com, CN=Joe Smith, OU=Human Resources, O=Acme.com, C=US
E = the first 'mail' ldap attribute value in user's entry - joesmithe@acme.com
CN = the (first) 'cn' ldap attribute value in the user's entry - Joe Smith
OU = the second 'ou' value in the ldap entry - IS
O = the (first) 'o' value in the user's entry DN - "Acme.com"
C = the constant string "US"
init in interface IAuthManagername - The name for this authentication manager instance.implName - The name of the authentication manager plugin.config - - The configuration store for this instance.EBaseException - If an error occurs during initialization.public void init(java.lang.String name,
java.lang.String implName,
IConfigStore config,
boolean needBaseDN)
throws EBaseException
EBaseExceptionpublic java.lang.String getName()
getName in interface IAuthManagerpublic java.lang.String getImplName()
getImplName in interface IAuthManagerpublic IAuthToken authenticate(IAuthCredentials authCred) throws EMissingCredential, EInvalidCredentials, EBaseException
authenticate in interface IAuthManagerauthCred - Authentication credentials, CRED_UID and CRED_PWD.EMissingCredential - If a required authentication credential is missing.EInvalidCredentials - If credentials failed authentication.EBaseException - If an internal error occurred.AuthTokenpublic abstract java.lang.String[] getRequiredCreds()
getRequiredCreds in interface IAuthManagerpublic abstract java.lang.String[] getConfigParams()
getConfigParams in interface IAuthManagerpublic void shutdown()
shutdown in interface IAuthManagerpublic IConfigStore getConfigStore()
getConfigStore in interface IAuthManagerprotected abstract java.lang.String authenticate(netscape.ldap.LDAPConnection conn,
IAuthCredentials authCreds,
AuthToken token)
throws EBaseException
authCreds - The authentication credentials.EInvalidCredentials - If the uid and password are not validEBaseException - If an internal error occurs.protected void formCertInfo(netscape.ldap.LDAPConnection conn,
java.lang.String userdn,
netscape.security.x509.X509CertInfo certinfo,
AuthToken token)
throws EBaseException
conn - A LDAP Connection authenticated to user to use.userdn - The user's dn.certinfo - A certinfo object to fill.token - A authentication token to fill.EBaseException - If an internal error occurs.protected void setAuthTokenValues(netscape.ldap.LDAPEntry e,
AuthToken tok)
protected void setAuthTokenStringValue(java.lang.String name,
netscape.ldap.LDAPEntry entry,
AuthToken tok)
protected void setAuthTokenByteValue(java.lang.String name,
netscape.ldap.LDAPEntry entry,
AuthToken tok)
protected java.lang.String[] getLdapAttrs()
protected java.lang.String[] getLdapByteAttrs()
protected java.lang.String formSubjectName(netscape.ldap.LDAPEntry entry)
throws EAuthException
entry - The LDAP entryEBaseException - If an internal error occurs.EAuthExceptionprotected void log(int level,
java.lang.String msg)
level - The log level.msg - The message to log.ILoggerpublic java.lang.String[] getExtendedPluginInfo(java.util.Locale locale)
IExtendedPluginInfogetExtendedPluginInfo in interface IExtendedPluginInfo