Package org.restlet.ext.jaas
Class JaasVerifier
- java.lang.Object
-
- org.restlet.ext.jaas.JaasVerifier
-
- All Implemented Interfaces:
Verifier
public class JaasVerifier extends java.lang.Object implements Verifier
Verifier that leverages the JAAS pluggable authentication mechanism.- See Also:
- JAAS Tutorials, JAAS Reference Guide
-
-
Field Summary
Fields Modifier and Type Field Description private javax.security.auth.login.ConfigurationconfigurationThe optional JAAS login configuration.private java.lang.StringnameThe JAAS login context name.private java.lang.StringuserPrincipalClassNameOptional class from which to build a user principal-
Fields inherited from interface org.restlet.security.Verifier
RESULT_INVALID, RESULT_MISSING, RESULT_STALE, RESULT_UNKNOWN, RESULT_UNSUPPORTED, RESULT_VALID
-
-
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.CallbackHandlercreateCallbackHandler(Request request, Response response)Creates a callback handler for the given parameters.javax.security.auth.login.ConfigurationgetConfiguration()Returns the optional JAAS login configuration.java.lang.StringgetName()Returns the JAAS login context name.java.lang.StringgetUserPrincipalClassName()Gets the user principal class name.voidsetConfiguration(javax.security.auth.login.Configuration configuration)Sets the optional JAAS login configuration.voidsetName(java.lang.String contextName)Sets the JAAS login context name.voidsetUserPrincipalClassName(java.lang.String userPrincipalClassName)Sets the user principal class name.intverify(Request request, Response response)Verifies that the proposed secret is correct for the specified identifier.
-
-
-
Field Detail
-
configuration
private volatile javax.security.auth.login.Configuration configuration
The optional JAAS login configuration.
-
name
private volatile java.lang.String name
The JAAS login context name.
-
userPrincipalClassName
private volatile java.lang.String userPrincipalClassName
Optional class from which to build a user principal
-
-
Method Detail
-
createCallbackHandler
protected javax.security.auth.callback.CallbackHandler createCallbackHandler(Request request, 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 aUseris not associated with theRequest'sClientInfoand if one of the principals returned after the JAAS login is of this type, a newUserwill be associated with theClientInfousing its name.- Parameters:
userPrincipalClassName- the user principal class name.
-
verify
public int verify(Request request, 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.
-
-