org.nuiton.wikitty.services
Class WikittySecurityUtil

java.lang.Object
  extended by org.nuiton.wikitty.services.WikittySecurityUtil

public class WikittySecurityUtil
extends Object

Security utility methods. This class should replace #WikittySecurityHelper User: couteau Date: 22/12/10


Field Summary
static String WIKITTY_APPADMIN_GROUP_NAME
          Name of the application administrators group
 
Constructor Summary
WikittySecurityUtil()
           
 
Method Summary
static WikittyGroup createAppAdminGroup(WikittyUser user)
          Create appAdminGroup and add current user as first member.
static String getUserForToken(WikittyService ws, String securityToken)
          Get a user corresponding to a securityToken
static boolean isMember(WikittyService ws, String securityToken, String userId, String groupId)
          Check on a WikittyService if a user is member of a group.
static boolean isOutdated(org.nuiton.util.ApplicationConfig config, WikittyService ws, String tokenId)
          Verifie si la date du token depasse le temps authorise pour un token Si l'option n'est pas presente dans la config retourne toujours false (donc le token a une validite permanente)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIKITTY_APPADMIN_GROUP_NAME

public static final String WIKITTY_APPADMIN_GROUP_NAME
Name of the application administrators group

See Also:
Constant Field Values
Constructor Detail

WikittySecurityUtil

public WikittySecurityUtil()
Method Detail

isOutdated

public static boolean isOutdated(org.nuiton.util.ApplicationConfig config,
                                 WikittyService ws,
                                 String tokenId)
Verifie si la date du token depasse le temps authorise pour un token Si l'option n'est pas presente dans la config retourne toujours false (donc le token a une validite permanente)

Parameters:
date - la date a verifier
Returns:
vrai si la date est depassee

isMember

public static boolean isMember(WikittyService ws,
                               String securityToken,
                               String userId,
                               String groupId)
Check on a WikittyService if a user is member of a group. A SecurityException might be thrown at runtime if the securityToken has expired.

Parameters:
ws - the wikitty service to do the check on
securityToken - the security token
userId - the user to check's wikitty id
groupId - the group to check the user is in's wikitty id
Returns:
true if the user is in the group, false otherwise

getUserForToken

public static String getUserForToken(WikittyService ws,
                                     String securityToken)
Get a user corresponding to a securityToken

Parameters:
ws - the WikittyService to do the check on
securityToken - the token of the user to search for.
Returns:
the wikitty Id of the user corresponding to the securityToken

createAppAdminGroup

public static WikittyGroup createAppAdminGroup(WikittyUser user)
Create appAdminGroup and add current user as first member. The group has to be stored after as it is not persisted in this method.

Parameters:
user - the user that will be the first admin group member
Returns:
the admin group


Copyright © 2009-2012 CodeLutin. All Rights Reserved.