|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.blojsom.authorization.PropertiesAuthorizationProvider org.blojsom.authorization.LDAPAuthorizationProvider
LDAPAuthorizationProvider
This implementation authenticates a user against an LDAP server. The user name must be the same as that of their LDAP user (uid). There are two ways to configure this in terms of the accepted users. The first is where only the blog owner can edit the blog. To use this technique, delete the authorization.properties file from the user's blog directory. The lack of this file tells the authorization logic to use the blog owner as the UID for LDAP authentication. The second way provides multiple user editing of a blog. This second way utilizes the authorization.properties file's user names (it ignores passwords and other data). Incoming authorization requests have the user name checked to see if it is listed in the authorization.properties file (indicating a user who is allowed to edit this blog). If it is in the list, this username is used as the LDAP UID. This class/implementation requires LDAP protocol version 3. You must set the configuration values defined by the BlojsomConstants: BLOG_LDAP_AUTHORIZATION_SERVER_IP, BLOG_LDAP_AUTHORIZATION_DN_IP, and BLOG_LDAP_AUTHORIZATION_PORT_IP (optional). Note, this implementation currently requires the Mozilla LDAP Java SDK. See http://www.mozilla.org/directory/.
Field Summary |
Fields inherited from class org.blojsom.authorization.PropertiesAuthorizationProvider |
_baseConfigurationDirectory, _servletConfig |
Constructor Summary | |
LDAPAuthorizationProvider()
Default constructor |
Method Summary | |
void |
authorize(BlogUser blogUser,
java.util.Map authorizationContext,
java.lang.String username,
java.lang.String password)
Authorize a username and password for the given BlogUser |
protected java.lang.String |
getBaseDN()
Return the LDAP base DN |
protected java.lang.String |
getDN(java.lang.String username)
Get the DN for a given username |
protected int |
getPort()
Return the LDAP server port |
protected java.lang.String |
getServer()
Return the LDAP server name |
void |
init(javax.servlet.ServletConfig servletConfig,
BlojsomConfiguration blojsomConfiguration)
Initialization method for the authorization provider |
void |
loadAuthenticationCredentials(BlogUser blogUser)
Loads/configures the authentication credentials for a given blog. |
Methods inherited from class org.blojsom.authorization.PropertiesAuthorizationProvider |
checkPermission |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LDAPAuthorizationProvider()
Method Detail |
public void init(javax.servlet.ServletConfig servletConfig, BlojsomConfiguration blojsomConfiguration) throws BlojsomConfigurationException
init
in interface AuthorizationProvider
init
in class PropertiesAuthorizationProvider
servletConfig
- ServletConfig for obtaining any initialization parametersblojsomConfiguration
- BlojsomConfiguration for blojsom-specific configuration information
BlojsomConfigurationException
- If there is an error initializing the providerpublic void loadAuthenticationCredentials(BlogUser blogUser) throws BlojsomException
loadAuthenticationCredentials
in interface AuthorizationProvider
loadAuthenticationCredentials
in class PropertiesAuthorizationProvider
blogUser
- BlogUser
BlojsomException
- If there is an error loading the user's authentication credentialspublic void authorize(BlogUser blogUser, java.util.Map authorizationContext, java.lang.String username, java.lang.String password) throws BlojsomException
BlogUser
authorize
in interface AuthorizationProvider
authorize
in class PropertiesAuthorizationProvider
blogUser
- BlogUser
authorizationContext
- Map
to be used to provide other information for authorization. This will
change depending on the authorization provider. This parameter is not used in this implementation.username
- Username. In this implementation, this value must match that of the blog user's ID.password
- Password
BlojsomException
- If there is an error authorizing the username and passwordprotected java.lang.String getDN(java.lang.String username)
username
- Username
null
if there is an exception in lookupprotected java.lang.String getServer()
protected int getPort()
protected java.lang.String getBaseDN()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |