org.apache.jetspeed.services
Class JetspeedSecurity

java.lang.Object
  extended byorg.apache.jetspeed.services.JetspeedSecurity

public abstract class JetspeedSecurity
extends java.lang.Object

This is a commodity static accessor class around the JetspeedSecurityService

Version:
$Id: JetspeedSecurity.java,v 1.21 2004/03/31 04:49:10 morciuch Exp $
Author:
David Sean Taylor, Mark Orciuch, Scott T. Weaver
See Also:
JetspeedSecurityService

Field Summary
static java.lang.String JETSPEED_GROUP
           
static java.lang.String JETSPEED_GROUP_ID
           
static java.lang.String JETSPEED_ROLE_ADMIN
           
static java.lang.String JETSPEED_ROLE_USER
           
static char[] LC_NUMBERS_AND_LETTERS_ALPHABET
          Alphabet consisting of lowercase letters a-z and the digits 0-9 Used to make a random password.
static char[] NUMBERS_AND_LETTERS_ALPHABET
          Alphabet consisting of upper and lowercase letters A-Z and the digits 0-9 Used to make a random password.
static java.lang.String PERMISSION_CLOSE
           
static java.lang.String PERMISSION_CUSTOMIZE
           
static java.lang.String PERMISSION_DETACH
           
static java.lang.String PERMISSION_INFO
           
static java.lang.String PERMISSION_MAXIMIZE
           
static java.lang.String PERMISSION_MINIMIZE
           
static java.lang.String PERMISSION_PERSONALIZE
           
static java.lang.String PERMISSION_PRINT_FRIENDLY
           
static java.lang.String PERMISSION_VIEW
           
 
Constructor Summary
JetspeedSecurity()
           
 
Method Summary
static void addGroup(Group group)
           
static void addPermission(Permission permission)
           
static void addRole(Role role)
           
static void addUser(JetspeedUser user)
           
static boolean areActionsDisabledForAllUsers()
           
static boolean areActionsDisabledForAnon()
           
static void changePassword(JetspeedUser user, java.lang.String oldPassword, java.lang.String newPassword)
           
static boolean checkDisableAccount(java.lang.String username)
           
static boolean checkPermission(JetspeedRunData runData, java.lang.String action, Portlet portlet)
           
static boolean checkPermission(JetspeedRunData runData, java.lang.String action, RegistryEntry entry)
           
static boolean checkPermission(JetspeedUser user, Entry entry, java.lang.String action)
           
static boolean checkPermission(JetspeedUser user, PortalResource resource, java.lang.String action)
           
static boolean checkPermission(JetspeedUser user, Portlet portlet, java.lang.String action)
           
static java.lang.String convertPassword(java.lang.String password)
           
static java.lang.String convertUserName(java.lang.String username)
           
static java.lang.String encryptPassword(java.lang.String password)
           
static void forcePassword(JetspeedUser user, java.lang.String password)
           
static java.lang.String generateLowerCasePassword(int length)
          A utility method that will generate a lowercase password consisting of random numbers and letters of length N
static java.lang.String generateMixedCasePassword(int length)
          A utility method that will generate a password consisting of random numbers and letters of length N
static java.lang.String generateUpperCasePassword(int length)
          A utility method that will generate an uppercase password consisting of random numbers and letters of length N
static java.util.List getAdminRoles()
           
static JetspeedUser getAnonymousUser()
           
static java.lang.String getAnonymousUserName()
           
static Group getGroup(java.lang.String groupname)
           
static java.util.Iterator getGroups()
           
static java.util.Iterator getGroups(java.lang.String username)
           
static Permission getPermission(java.lang.String permissionName)
           
static java.util.Iterator getPermissions()
           
static java.util.Iterator getPermissions(java.lang.String rolename)
           
static Role getRole(java.lang.String rolename)
           
static java.util.Iterator getRoles()
           
static java.util.Iterator getRoles(java.lang.String username)
           
static SecurityReference getSecurityReference(Entry entry, JetspeedRunData rundata)
          Utility method for retreiving the correct security reference based on profile and registry information.
static int getSecuritySource(Entry entry, JetspeedRunData rundata)
          Checks where the security of this Entry is actually defined.
static JetspeedSecurityService getService()
          Commodity method for getting a reference to the service singleton
static JetspeedUser getUser(java.security.Principal principal)
           
static JetspeedUser getUser(java.lang.String username)
           
static JetspeedUser getUserInstance()
           
static java.util.Iterator getUsers()
           
static java.util.Iterator getUsers(java.lang.String filter)
           
static void grantPermission(java.lang.String roleName, java.lang.String permissionName)
           
static void grantRole(java.lang.String username, java.lang.String rolename)
           
static void grantRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
static boolean hasAdminRole(org.apache.turbine.om.security.User user)
           
static boolean hasPermission(java.lang.String roleName, java.lang.String permissionName)
           
static boolean hasRole(java.lang.String username, java.lang.String rolename)
           
static boolean hasRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
static boolean inGroup(java.lang.String username, java.lang.String groupname)
           
static boolean isDisableAccountCheckEnabled()
           
static void joinGroup(java.lang.String username, java.lang.String groupname)
           
static void joinGroup(java.lang.String username, java.lang.String groupname, java.lang.String rolename)
           
static JetspeedUser login(java.lang.String username, java.lang.String password)
           
static void logout()
           
static void removeGroup(java.lang.String groupname)
           
static void removePermission(java.lang.String permissionName)
           
static void removeRole(java.lang.String rolename)
           
static void removeUser(java.security.Principal principal)
           
static void removeUser(java.lang.String username)
           
static void resetDisableAccountCheck(java.lang.String username)
           
static void revokePermission(java.lang.String roleName, java.lang.String permissionName)
           
static void revokeRole(java.lang.String username, java.lang.String rolename)
           
static void revokeRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
static void saveGroup(Group group)
           
static void savePermission(Permission permission)
           
static void saveRole(Role role)
           
static void saveUser(JetspeedUser user)
           
static void unjoinGroup(java.lang.String username, java.lang.String groupname)
           
static void unjoinGroup(java.lang.String username, java.lang.String groupname, java.lang.String rolename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERMISSION_VIEW

public static final java.lang.String PERMISSION_VIEW
See Also:
Constant Field Values

PERMISSION_CUSTOMIZE

public static final java.lang.String PERMISSION_CUSTOMIZE
See Also:
Constant Field Values

PERMISSION_MAXIMIZE

public static final java.lang.String PERMISSION_MAXIMIZE
See Also:
Constant Field Values

PERMISSION_MINIMIZE

public static final java.lang.String PERMISSION_MINIMIZE
See Also:
Constant Field Values

PERMISSION_PERSONALIZE

public static final java.lang.String PERMISSION_PERSONALIZE
See Also:
Constant Field Values

PERMISSION_DETACH

public static final java.lang.String PERMISSION_DETACH
See Also:
Constant Field Values

PERMISSION_CLOSE

public static final java.lang.String PERMISSION_CLOSE
See Also:
Constant Field Values

PERMISSION_INFO

public static final java.lang.String PERMISSION_INFO
See Also:
Constant Field Values

PERMISSION_PRINT_FRIENDLY

public static final java.lang.String PERMISSION_PRINT_FRIENDLY
See Also:
Constant Field Values

JETSPEED_GROUP

public static final java.lang.String JETSPEED_GROUP
See Also:
Constant Field Values

JETSPEED_GROUP_ID

public static final java.lang.String JETSPEED_GROUP_ID
See Also:
Constant Field Values

JETSPEED_ROLE_USER

public static final java.lang.String JETSPEED_ROLE_USER
See Also:
Constant Field Values

JETSPEED_ROLE_ADMIN

public static final java.lang.String JETSPEED_ROLE_ADMIN
See Also:
Constant Field Values

NUMBERS_AND_LETTERS_ALPHABET

public static final char[] NUMBERS_AND_LETTERS_ALPHABET
Alphabet consisting of upper and lowercase letters A-Z and the digits 0-9 Used to make a random password.


LC_NUMBERS_AND_LETTERS_ALPHABET

public static final char[] LC_NUMBERS_AND_LETTERS_ALPHABET
Alphabet consisting of lowercase letters a-z and the digits 0-9 Used to make a random password.

Constructor Detail

JetspeedSecurity

public JetspeedSecurity()
Method Detail

getService

public static JetspeedSecurityService getService()
Commodity method for getting a reference to the service singleton


login

public static JetspeedUser login(java.lang.String username,
                                 java.lang.String password)
                          throws LoginException
Throws:
LoginException
See Also:
PortalAuthentication#login

getAnonymousUser

public static JetspeedUser getAnonymousUser()
                                     throws LoginException
Throws:
LoginException
See Also:
PortalAuthentication#getAnonymousUser

logout

public static void logout()
                   throws LoginException
Throws:
LoginException
See Also:
PortalAuthentication#logout

checkPermission

public static boolean checkPermission(JetspeedUser user,
                                      Entry entry,
                                      java.lang.String action)
See Also:
JetspeedPortalAccessController.checkPermission(org.apache.jetspeed.om.security.JetspeedUser, org.apache.jetspeed.om.profile.Entry, java.lang.String)

checkPermission

public static boolean checkPermission(JetspeedUser user,
                                      Portlet portlet,
                                      java.lang.String action)
See Also:
JetspeedPortalAccessController.checkPermission(org.apache.jetspeed.om.security.JetspeedUser, org.apache.jetspeed.om.profile.Entry, java.lang.String)

checkPermission

public static boolean checkPermission(JetspeedUser user,
                                      PortalResource resource,
                                      java.lang.String action)
See Also:
JetspeedPortalAccessController.checkPermission(org.apache.jetspeed.om.security.JetspeedUser, org.apache.jetspeed.om.profile.Entry, java.lang.String)

getUser

public static JetspeedUser getUser(java.security.Principal principal)
                            throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#getUser

getUsers

public static java.util.Iterator getUsers()
                                   throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#getUsers

saveUser

public static void saveUser(JetspeedUser user)
                     throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#saveUser

addUser

public static void addUser(JetspeedUser user)
                    throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#addUser

getUsers

public static java.util.Iterator getUsers(java.lang.String filter)
                                   throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#getUsers(String)

removeUser

public static void removeUser(java.security.Principal principal)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#removeUser

getUser

public static JetspeedUser getUser(java.lang.String username)
                            throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#getUser

removeUser

public static void removeUser(java.lang.String username)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
UserManagement#removeUser

changePassword

public static void changePassword(JetspeedUser user,
                                  java.lang.String oldPassword,
                                  java.lang.String newPassword)
                           throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
CredentialsManagement#changePassword

forcePassword

public static void forcePassword(JetspeedUser user,
                                 java.lang.String password)
                          throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
CredentialsManagement#forcePassword

encryptPassword

public static java.lang.String encryptPassword(java.lang.String password)
                                        throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
CredentialsManagement#encryptPassword

getRoles

public static java.util.Iterator getRoles(java.lang.String username)
                                   throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#getRoles(String)

getRoles

public static java.util.Iterator getRoles()
                                   throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#getRoles

addRole

public static void addRole(Role role)
                    throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#addRole

saveRole

public static void saveRole(Role role)
                     throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#saveRole

removeRole

public static void removeRole(java.lang.String rolename)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#removeRole

grantRole

public static void grantRole(java.lang.String username,
                             java.lang.String rolename)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#grantRole

grantRole

public static void grantRole(java.lang.String username,
                             java.lang.String rolename,
                             java.lang.String groupname)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#grantRole

revokeRole

public static void revokeRole(java.lang.String username,
                              java.lang.String rolename)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#revokeRole

revokeRole

public static void revokeRole(java.lang.String username,
                              java.lang.String rolename,
                              java.lang.String groupname)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#revokeRole()

hasRole

public static boolean hasRole(java.lang.String username,
                              java.lang.String rolename)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#hasRole

hasRole

public static boolean hasRole(java.lang.String username,
                              java.lang.String rolename,
                              java.lang.String groupname)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException

getRole

public static Role getRole(java.lang.String rolename)
                    throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
RoleManagement#getRole

getGroups

public static java.util.Iterator getGroups(java.lang.String username)
                                    throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#getGroups(String)

getGroups

public static java.util.Iterator getGroups()
                                    throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#getGroups

addGroup

public static void addGroup(Group group)
                     throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#addGroup

saveGroup

public static void saveGroup(Group group)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#saveGroup

removeGroup

public static void removeGroup(java.lang.String groupname)
                        throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#removeGroup

joinGroup

public static void joinGroup(java.lang.String username,
                             java.lang.String groupname)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#joinGroup

joinGroup

public static void joinGroup(java.lang.String username,
                             java.lang.String groupname,
                             java.lang.String rolename)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#joinGroup(String username, String groupname, String rolename)

unjoinGroup

public static void unjoinGroup(java.lang.String username,
                               java.lang.String groupname)
                        throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#revokeGroup

unjoinGroup

public static void unjoinGroup(java.lang.String username,
                               java.lang.String groupname,
                               java.lang.String rolename)
                        throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#revokeGroup(String username, String groupname, String rolename)

inGroup

public static boolean inGroup(java.lang.String username,
                              java.lang.String groupname)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#inGroup

getGroup

public static Group getGroup(java.lang.String groupname)
                      throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
GroupManagement#getGroup

getUserInstance

public static JetspeedUser getUserInstance()
See Also:
JetspeedSecurityService.getUserInstance()

convertUserName

public static java.lang.String convertUserName(java.lang.String username)
See Also:
JetspeedSecurityService.convertUserName(java.lang.String)

convertPassword

public static java.lang.String convertPassword(java.lang.String password)
See Also:
JetspeedSecurityService.convertPassword(java.lang.String)

checkDisableAccount

public static boolean checkDisableAccount(java.lang.String username)
See Also:
JetspeedSecurityService#checkDisableAcccount

isDisableAccountCheckEnabled

public static boolean isDisableAccountCheckEnabled()
See Also:
JetspeedSecurityService#isDisableCountCheckEnabled

resetDisableAccountCheck

public static void resetDisableAccountCheck(java.lang.String username)
See Also:
JetspeedSecurityService.resetDisableAccountCheck(java.lang.String)

areActionsDisabledForAnon

public static boolean areActionsDisabledForAnon()
See Also:
JetspeedSecurityService.areActionsDisabledForAnon()

areActionsDisabledForAllUsers

public static boolean areActionsDisabledForAllUsers()
See Also:
JetspeedSecurityService.areActionsDisabledForAllUsers()

getAnonymousUserName

public static java.lang.String getAnonymousUserName()

getAdminRoles

public static java.util.List getAdminRoles()

hasAdminRole

public static boolean hasAdminRole(org.apache.turbine.om.security.User user)

checkPermission

public static boolean checkPermission(JetspeedRunData runData,
                                      java.lang.String action,
                                      Portlet portlet)
See Also:
JetspeedSecurityService.checkPermission(org.apache.jetspeed.services.rundata.JetspeedRunData, java.lang.String, org.apache.jetspeed.portal.Portlet)

checkPermission

public static boolean checkPermission(JetspeedRunData runData,
                                      java.lang.String action,
                                      RegistryEntry entry)
See Also:
JetspeedSecurityService.checkPermission(org.apache.jetspeed.services.rundata.JetspeedRunData, java.lang.String, org.apache.jetspeed.portal.Portlet)

getPermissions

public static java.util.Iterator getPermissions(java.lang.String rolename)
                                         throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#getPermissions(String)

getPermissions

public static java.util.Iterator getPermissions()
                                         throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#getPermissions

addPermission

public static void addPermission(Permission permission)
                          throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#addPermission

savePermission

public static void savePermission(Permission permission)
                           throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#savePermission

removePermission

public static void removePermission(java.lang.String permissionName)
                             throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#removePermission

grantPermission

public static void grantPermission(java.lang.String roleName,
                                   java.lang.String permissionName)
                            throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#grantPermission

revokePermission

public static void revokePermission(java.lang.String roleName,
                                    java.lang.String permissionName)
                             throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#revokePermission

hasPermission

public static boolean hasPermission(java.lang.String roleName,
                                    java.lang.String permissionName)
                             throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#hasPermission

getPermission

public static Permission getPermission(java.lang.String permissionName)
                                throws JetspeedSecurityException
Throws:
JetspeedSecurityException
See Also:
PermissionManagement#getPermission

generateMixedCasePassword

public static java.lang.String generateMixedCasePassword(int length)
                                                  throws JetspeedSecurityException
A utility method that will generate a password consisting of random numbers and letters of length N

Parameters:
length -
Returns:
String
Throws:
JetspeedSecurityException

generateLowerCasePassword

public static java.lang.String generateLowerCasePassword(int length)
                                                  throws JetspeedSecurityException
A utility method that will generate a lowercase password consisting of random numbers and letters of length N

Parameters:
length -
Returns:
String
Throws:
JetspeedSecurityException

generateUpperCasePassword

public static java.lang.String generateUpperCasePassword(int length)
                                                  throws JetspeedSecurityException
A utility method that will generate an uppercase password consisting of random numbers and letters of length N

Parameters:
length -
Returns:
String
Throws:
JetspeedSecurityException

getSecurityReference

public static SecurityReference getSecurityReference(Entry entry,
                                                     JetspeedRunData rundata)
Utility method for retreiving the correct security reference based on profile and registry information.


getSecuritySource

public static int getSecuritySource(Entry entry,
                                    JetspeedRunData rundata)
Checks where the security of this Entry is actually defined.

Returns:
int
  • 0 if there is security assigned at the profile level.
  • 1 if there is security assigned at the registry level.
  • 2 if the 2 previous assertion are false (inheriting)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.