org.apache.jetspeed.services.security
Class JetspeedDBSecurityService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.security.JetspeedDBSecurityService
All Implemented Interfaces:
org.apache.turbine.services.Initable, JetspeedSecurityService, org.apache.turbine.services.Service

public class JetspeedDBSecurityService
extends org.apache.turbine.services.TurbineBaseService
implements JetspeedSecurityService

This is an implementation of the JetspeedSecurityService interface.

Version:
$Id: JetspeedDBSecurityService.java,v 1.25 2004/03/31 04:49:10 morciuch Exp $
Author:
David Sean Taylor, Santiago Gala

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.security.JetspeedSecurityService
SERVICE_NAME
 
Constructor Summary
JetspeedDBSecurityService()
           
 
Method Summary
 boolean areActionsDisabledForAllUsers()
           
 boolean areActionsDisabledForAnon()
          Helper to PortalAuthorization.
 boolean checkDisableAccount(java.lang.String username)
           
 boolean checkPermission(JetspeedRunData runData, java.lang.String action, Portlet portlet)
          Helper to PortalAuthorization.
 java.lang.String convertPassword(java.lang.String password)
           
 java.lang.String convertUserName(java.lang.String username)
           
 java.util.List getAdminRoles()
           
 java.lang.String getAnonymousUserName()
           
 JetspeedUser getUser(java.lang.String username)
          Helper to UserManagement.
 JetspeedUser getUserInstance()
           
 boolean hasAdminRole(org.apache.turbine.om.security.User user)
          Returns true if user has administrative role
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 boolean isDisableAccountCheckEnabled()
           
 void resetDisableAccountCheck(java.lang.String username)
           
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Constructor Detail

JetspeedDBSecurityService

public JetspeedDBSecurityService()
Method Detail

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

getUserInstance

public JetspeedUser getUserInstance()
Specified by:
getUserInstance in interface JetspeedSecurityService

convertUserName

public java.lang.String convertUserName(java.lang.String username)
Specified by:
convertUserName in interface JetspeedSecurityService

convertPassword

public java.lang.String convertPassword(java.lang.String password)
Specified by:
convertPassword in interface JetspeedSecurityService

checkDisableAccount

public boolean checkDisableAccount(java.lang.String username)
Specified by:
checkDisableAccount in interface JetspeedSecurityService

isDisableAccountCheckEnabled

public boolean isDisableAccountCheckEnabled()
Specified by:
isDisableAccountCheckEnabled in interface JetspeedSecurityService

resetDisableAccountCheck

public void resetDisableAccountCheck(java.lang.String username)
Specified by:
resetDisableAccountCheck in interface JetspeedSecurityService

getUser

public JetspeedUser getUser(java.lang.String username)
                     throws JetspeedSecurityException
Helper to UserManagement. Retrieves a JetspeedUser given the primary principle username. The principal can be any valid Jetspeed Security Principal: org.apache.jetspeed.om.security.UserNamePrincipal org.apache.jetspeed.om.security.UserIdPrincipal The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
getUser in interface JetspeedSecurityService
Parameters:
username - The username principal.
Returns:
a JetspeedUser associated to the principal identity.
Throws:
UserException - when the security provider has a general failure retrieving a user.
UnknownUserException - when the security provider cannot match the principal identity to a user.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

checkPermission

public boolean checkPermission(JetspeedRunData runData,
                               java.lang.String action,
                               Portlet portlet)
Helper to PortalAuthorization. Gets a JetspeedUser from rundata, authorize user to perform the secured action on the given Portlet resource. If the user does not have sufficient privilege to perform the action on the resource, the check returns false, otherwise when sufficient privilege is present, checkPermission returns true.

Specified by:
checkPermission in interface JetspeedSecurityService
Parameters:
action - the secured action to be performed on the resource by the user.
portlet - the portlet resource.
Returns:
boolean true if the user has sufficient privilege.

areActionsDisabledForAnon

public boolean areActionsDisabledForAnon()
Helper to PortalAuthorization. Gets a JetspeedUser from rundata, authorize user to perform the secured action on the given Entry resource. If the user does not have sufficient privilege to perform the action on the resource, the check returns false, otherwise when sufficient privilege is present, checkPermission returns true.

Specified by:
areActionsDisabledForAnon in interface JetspeedSecurityService
Returns:
boolean true if the user has sufficient privilege. public boolean checkPermission(JetspeedRunData runData, String action, RegistryEntry entry) { return JetspeedPortalAccessController.checkPermission(runData.getJetspeedUser(), entry, action); }

areActionsDisabledForAllUsers

public boolean areActionsDisabledForAllUsers()
Specified by:
areActionsDisabledForAllUsers in interface JetspeedSecurityService

getAnonymousUserName

public java.lang.String getAnonymousUserName()
Specified by:
getAnonymousUserName in interface JetspeedSecurityService

getAdminRoles

public java.util.List getAdminRoles()
Specified by:
getAdminRoles in interface JetspeedSecurityService

hasAdminRole

public boolean hasAdminRole(org.apache.turbine.om.security.User user)
Returns true if user has administrative role

Specified by:
hasAdminRole in interface JetspeedSecurityService
Parameters:
user -
Returns:
true if user has administrative role


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