|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.web.tapestry5.services.ServiceAuthenticationImpl<U,A>
U - user typeA - annotation type used to identify which page need authenticationpublic class ServiceAuthenticationImpl<U,A extends Annotation>
This class is an abstract implementation of ServiceAuthentication.
This service use ApplicationStateManager to manage connected user.
You can inherit this class to provide a momre specific authentication
managmentan depends on user type and annotation used to identify
pages that need authentication. This behavior is done in
isAllowed(Class) that detect the annotation on the page (ex :
RequiresAuthentication annotation) and call the method
checkAuthorizations(Object, Annotation) that is implemented by
default to do nothing (return true).
public ServiceAuthenticationNo need to contribute to ApplicationStateManager to provide instantiation of user. Even this service used the default constructor to instanciate a new user. Created: 3 mai 2010buildServiceAuthentication(ApplicationStateManager stateManager) { return new ServiceAuthenticationImpl (stateManager); }
| Field Summary | |
|---|---|
protected Class<A> |
annotationClass
Annotation type to detect pages that need authentication (ex : RequiresAuthentication). |
protected Class<U> |
userClass
User type |
| Constructor Summary | |
|---|---|
ServiceAuthenticationImpl(org.apache.tapestry5.services.ApplicationStateManager stateManager,
Class<U> userClass,
Class<A> annotationClass)
Constructor to call in subclasses. |
|
| Method Summary | |
|---|---|
protected boolean |
checkAuthorizations(U user,
A annotation)
Check the connected user authorizations. |
U |
getNewUserInstance()
Default instanciation of the user. |
U |
getUserConnected()
Get the current user connected. |
boolean |
isAllowed(Class<?> page)
Detect the annotation in the given page. |
boolean |
isUserConnected()
Detect if user is connected. |
void |
setUserConnected(U user)
Set the connected user to user. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Class<U> userClass
protected Class<A extends Annotation> annotationClass
| Constructor Detail |
|---|
public ServiceAuthenticationImpl(org.apache.tapestry5.services.ApplicationStateManager stateManager,
Class<U> userClass,
Class<A> annotationClass)
stateManager - from TapestryuserClass - to identify which type of user is managedannotationClass - to identify which type of annotation is managed
for authentication treatment.| Method Detail |
|---|
public boolean isUserConnected()
ServiceAuthentication
isUserConnected in interface ServiceAuthentication<U>public U getUserConnected()
ServiceAuthentication
getUserConnected in interface ServiceAuthentication<U>public void setUserConnected(U user)
ServiceAuthenticationuser.
setUserConnected in interface ServiceAuthentication<U>user - that will be connectedpublic boolean isAllowed(Class<?> page)
page. If annotation is
detected, the user authorizations need to be check using
checkAuthorizations(Object, Annotation) method.
isAllowed in interface ServiceAuthentication<U>page - to check
protected boolean checkAuthorizations(U user,
A annotation)
isAllowed(Class) method after detect the annotation on the
current page. Override this method to provide more specific
authentication managment.
user - current user connected.annotation - from page to check authorizations.
public U getNewUserInstance()
getNewUserInstance in interface ServiceAuthentication<U>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||