org.ops4j.pax.wicket.api
Interface PaxWicketAuthentication

All Known Implementing Classes:
PaxWicketSession

public interface PaxWicketAuthentication

PaxWicketAuthentication represents a subset of the current Session. Typical usage would be;

 import org.apache.wicket.authorization.AuthorizationException;
 import org.apache.wicket.authorization.strategies.role.Roles;

 :

 public class SomeContentSource extends AbstractContentSource
 {

     protected Panel createComponent( String contentId )
     {
         PaxWicketAuthentication auth = getAuthentication();
         Roles roles = auth.getRoles();
         if( ! roles.hasRole( MyRoles.MEMBER ) )
         {
             throw new AuthorizationException( "Only members are allowed in this area." );
         }
         String username = auth.getLoggedInUser();
         return new MyPanel( username, .... );
     }
 }
 

Since:
1.0.0

Method Summary
 java.lang.String getLoggedInUser()
           
 org.apache.wicket.authorization.strategies.role.Roles getRoles()
           
 

Method Detail

getLoggedInUser

java.lang.String getLoggedInUser()
Returns:
The user that is logged in, in the request that this PaxWicketAuthentication is part of.
Since:
1.0.0

getRoles

org.apache.wicket.authorization.strategies.role.Roles getRoles()
Returns:
The Roles of the user that is logged in.
Since:
1.0.0


Copyright © 2008. All Rights Reserved.