org.restlet.ext.jaas
Class JaasVerifier

java.lang.Object
  extended by org.restlet.ext.jaas.JaasVerifier
All Implemented Interfaces:
Verifier

public class JaasVerifier
extends Object
implements Verifier

Verifier that leverages the JAAS pluggable authentication mechanism.

Author:
Jerome Louvel
See Also:
JAAS Tutorials, JAAS Reference Guide

Field Summary
 
Fields inherited from interface org.restlet.security.Verifier
RESULT_INVALID, RESULT_MISSING, RESULT_STALE, RESULT_UNKNOWN, RESULT_UNSUPPORTED, RESULT_VALID
 
Constructor Summary
JaasVerifier(String name)
          Constructor.
 
Method Summary
protected  CallbackHandler createCallbackHandler(Request request, Response response)
          Creates a callback handler for the given parameters.
 Configuration getConfiguration()
          Returns the optional JAAS login configuration.
 String getName()
          Returns the JAAS login context name.
 String getUserPrincipalClassName()
          Gets the user principal class name.
 void setConfiguration(Configuration configuration)
          Sets the optional JAAS login configuration.
 void setName(String contextName)
          Sets the JAAS login context name.
 void setUserPrincipalClassName(String userPrincipalClassName)
          Sets the user principal class name.
 int verify(Request request, Response response)
          Verifies that the proposed secret is correct for the specified identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaasVerifier

public JaasVerifier(String name)
Constructor.

Parameters:
name - The JAAS login context name.
Method Detail

createCallbackHandler

protected 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 Configuration getConfiguration()
Returns the optional JAAS login configuration.

Returns:
The optional JAAS login configuration.

getName

public String getName()
Returns the JAAS login context name.

Returns:
The JAAS login context name.

getUserPrincipalClassName

public String getUserPrincipalClassName()
Gets the user principal class name.

Returns:
the user principal class name.

setConfiguration

public void setConfiguration(Configuration configuration)
Sets the optional JAAS login configuration.

Parameters:
configuration - The optional JAAS login configuration.

setName

public void setName(String contextName)
Sets the JAAS login context name.

Parameters:
contextName - The JAAS login context name.

setUserPrincipalClassName

public void setUserPrincipalClassName(String userPrincipalClassName)
Sets the user principal class name. If a User is not associated with the Request's ClientInfo and if one of the principals returned after the JAAS login is of this type, a new User will be associated with the ClientInfo using 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 by createCallbackHandler(Request, Response) and calls the LoginContext.login() method on it.

Specified by:
verify in interface Verifier
Parameters:
request - The request sent.
response - The response to update.
Returns:
Result of the verification based on the RESULT_* constants.


Copyright © 2005-2013 Restlet.