|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jfw.authentication.Authorization
public class Authorization
Used in the authorization phase.
The methods are logically divided in two categories:
Authorization authorization = new Authorization();
int authorizationResult = authorization.authorize(request, response, userData);
if(authorizationResult == Authorization.AUTHORIZE_ALL)
System.out.println("all users can execute the service");
else if(authorizationResult == Authorization.AUTHORIZE_AUTHENTICATED)
System.out.println("all authenticated users can execute the service");
else if(authorizationResult == Authorization.AUTHORIZED_YES)
System.out.println("user set in UserData can execute the service");
else if(authorizationResult == Authorization.AUTHORIZED_NO)
System.out.println("user set in UserData can not execute the service");
else if(authorizationResult == Authorization.SERVICE_NOT_FOUND)
System.out.println("service name not exist in database");
| Constructor Summary | |
|---|---|
Authorization()
Create an instance. |
|
Authorization(java.lang.String connectionResourceName)
Create an instance. |
|
| Method Summary | |
|---|---|
int |
authorize(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
UserData userData)
User authorization. |
static int |
checkUserServicePermission(java.lang.String serviceName,
UserData userData)
Check in database if user can execute a service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SERVICE_NOT_FREE
public static final java.lang.String SERVICE_FREE
public static final java.lang.String SERVICE_FREE_AFTER_AUTHENTICATION
public static final int AUTHORIZED_NO
authorize(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.jfw.authentication.UserData).
public static final int AUTHORIZED_YES
authorize(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.jfw.authentication.UserData).
public static final int AUTHORIZE_ALL
authorize(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.jfw.authentication.UserData).
public static final int AUTHORIZE_AUTHENTICATED
authorize(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.jfw.authentication.UserData).
public static final int SERVICE_NOT_FOUND
authorize(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.jfw.authentication.UserData).
| Constructor Detail |
|---|
public Authorization()
public Authorization(java.lang.String connectionResourceName)
connectionResourceName - the database resource to use.| Method Detail |
|---|
public int authorize(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
UserData userData)
throws java.lang.Exception
request - an HttpServletRequest object.response - an HttpServletResponse object.userData - an UserData object or
null if the user is not authenticated.
AUTHORIZED_NO: user can not execute the service.
AUTHORIZED_YES: user can execute the service.
AUTHORIZE_ALL: all users can execute the service.
AUTHORIZE_AUTHENTICATED: all authenticated users can execute the service.
SERVICE_NOT_FOUND: service name not exist in database.java.lang.Exception
public static int checkUserServicePermission(java.lang.String serviceName,
UserData userData)
throws java.lang.Exception
serviceName - the service name (column SERVICE.SERVCE_NAME).userData - an UserData object.
AUTHORIZED_NO: user can not execute the service.
AUTHORIZED_YES: user can execute the service.java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||