Package org.restlet.ext.jaas
Class JaasVerifier
- java.lang.Object
-
- org.restlet.ext.jaas.JaasVerifier
-
- All Implemented Interfaces:
org.restlet.security.Verifier
public class JaasVerifier extends java.lang.Object implements org.restlet.security.Verifier
Verifier that leverages the JAAS pluggable authentication mechanism.- Author:
- Jerome Louvel
- See Also:
- JAAS Tutorials, JAAS Reference Guide
-
-
Constructor Summary
Constructors Constructor Description JaasVerifier(java.lang.String name)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.security.auth.callback.CallbackHandler
createCallbackHandler(org.restlet.Request request, org.restlet.Response response)
Creates a callback handler for the given parameters.javax.security.auth.login.Configuration
getConfiguration()
Returns the optional JAAS login configuration.java.lang.String
getName()
Returns the JAAS login context name.java.lang.String
getUserPrincipalClassName()
Gets the user principal class name.void
setConfiguration(javax.security.auth.login.Configuration configuration)
Sets the optional JAAS login configuration.void
setName(java.lang.String contextName)
Sets the JAAS login context name.void
setUserPrincipalClassName(java.lang.String userPrincipalClassName)
Sets the user principal class name.int
verify(org.restlet.Request request, org.restlet.Response response)
Verifies that the proposed secret is correct for the specified identifier.
-
-
-
Method Detail
-
createCallbackHandler
protected javax.security.auth.callback.CallbackHandler createCallbackHandler(org.restlet.Request request, org.restlet.Response response)
Creates a callback handler for the given parameters. By default it returns one handler that handles name and password JAAS callbacks.- Returns:
- The callback handler created.
-
getConfiguration
public javax.security.auth.login.Configuration getConfiguration()
Returns the optional JAAS login configuration.- Returns:
- The optional JAAS login configuration.
-
getName
public java.lang.String getName()
Returns the JAAS login context name.- Returns:
- The JAAS login context name.
-
getUserPrincipalClassName
public java.lang.String getUserPrincipalClassName()
Gets the user principal class name.- Returns:
- the user principal class name.
-
setConfiguration
public void setConfiguration(javax.security.auth.login.Configuration configuration)
Sets the optional JAAS login configuration.- Parameters:
configuration
- The optional JAAS login configuration.
-
setName
public void setName(java.lang.String contextName)
Sets the JAAS login context name.- Parameters:
contextName
- The JAAS login context name.
-
setUserPrincipalClassName
public void setUserPrincipalClassName(java.lang.String userPrincipalClassName)
Sets the user principal class name. If aUser
is not associated with theRequest
'sClientInfo
and if one of the principals returned after the JAAS login is of this type, a newUser
will be associated with theClientInfo
using its name.- Parameters:
userPrincipalClassName
- the user principal class name.
-
verify
public int verify(org.restlet.Request request, org.restlet.Response response)
Verifies that the proposed secret is correct for the specified identifier. By default, it creates a JAAS login context with the callback handler obtained bycreateCallbackHandler(Request, Response)
and calls theLoginContext.login()
method on it.- Specified by:
verify
in interfaceorg.restlet.security.Verifier
- Parameters:
request
- The request sent.response
- The response to update.- Returns:
- Result of the verification based on the RESULT_* constants.
-
-