org.ow2.jonas.web.jetty6.security
Class JettyPrincipal

java.lang.Object
  extended by org.ow2.jonas.web.jetty6.security.JettyPrincipal
All Implemented Interfaces:
Principal

public class JettyPrincipal
extends Object
implements Principal

Define a principal which can be used by Jetty.

Author:
Florent Benoit

Constructor Summary
JettyPrincipal(String name, List<String> roles)
          Constructor.
 
Method Summary
 String getName()
          Get the name of this principal.
 List<String> getRoles()
          Gets the roles of this user.
 boolean isAuthenticated()
          This user is authenticated ?
 boolean isUserInRole(String role)
          Check if the given role is in the user's roles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

JettyPrincipal

public JettyPrincipal(String name,
                      List<String> roles)
Constructor.

Parameters:
name - name of this principal
roles - roles for this principal
Method Detail

getName

public String getName()
Get the name of this principal.

Specified by:
getName in interface Principal
Returns:
the name of this principal

isAuthenticated

public boolean isAuthenticated()
This user is authenticated ?

Returns:
true if it is authenticated

isUserInRole

public boolean isUserInRole(String role)
Check if the given role is in the user's roles.

Parameters:
role - the given role
Returns:
true if the role is in the user's roles

getRoles

public List<String> getRoles()
Gets the roles of this user.

Returns:
roles of this user


Copyright © 2010 OW2 Consortium. All Rights Reserved.