com.googlecode.fascinator.portal.services.impl
Class PortalSecurityManagerImpl

java.lang.Object
  extended by com.googlecode.fascinator.portal.services.impl.PortalSecurityManagerImpl
All Implemented Interfaces:
PortalSecurityManager

public class PortalSecurityManagerImpl
extends Object
implements PortalSecurityManager

The security manager coordinates access to various security plugins when cross plugin awareness is required, and executes some server side logic required for features such as single sign-on.

Author:
Greg Pendlebury

Constructor Summary
PortalSecurityManagerImpl()
          Basic constructor, should be run automatically by Tapestry.
 
Method Summary
 AccessControlManager getAccessControlManager()
          Return the Access Control Manager
 AuthManager getAuthManager()
          Return the Authentication Manager
 RolesManager getRoleManager()
          Return the Role Manager
 String[] getRolesList(JsonSessionState session, User user)
          Get the list of roles possessed by the current user.
 User getUser(JsonSessionState session, String username, String source)
          Retrieve the details of a user by username
 void logout(JsonSessionState session, User user)
          Logout the provided user
 boolean runSsoIntegration(JsonSessionState session, FormData formData)
          Wrapper method for other SSO methods provided by the security manager.
 Map<String,Map<String,String>> ssoBuildLogonInterface(JsonSessionState session)
          Build a Map of Maps of on-screen string values for each SSO provider.
 boolean ssoCheckUserDetails(JsonSessionState session)
          Get user details from SSO connection and set them in the user session.
 String ssoGetRemoteLogonURL(JsonSessionState session, String source)
          Retrieve the login URL for redirection against a given provider.
 String ssoInit(JsonSessionState session)
          Initialize the SSO Service, prepare a login if required
 boolean testForSso(JsonSessionState session, String resource, String uri)
          Given the provided resource, test whether SSO should be 'aware' of this resource.
 boolean testTrustToken(JsonSessionState session, String token)
          Validate the provided trust token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortalSecurityManagerImpl

public PortalSecurityManagerImpl()
                          throws IOException
Basic constructor, should be run automatically by Tapestry.

Throws:
IOException
Method Detail

getAccessControlManager

public AccessControlManager getAccessControlManager()
Return the Access Control Manager

Specified by:
getAccessControlManager in interface PortalSecurityManager
Returns:
AccessControlManager

getAuthManager

public AuthManager getAuthManager()
Return the Authentication Manager

Specified by:
getAuthManager in interface PortalSecurityManager
Returns:
AuthManager

getRoleManager

public RolesManager getRoleManager()
Return the Role Manager

Specified by:
getRoleManager in interface PortalSecurityManager
Returns:
RolesManager

getRolesList

public String[] getRolesList(JsonSessionState session,
                             User user)
Get the list of roles possessed by the current user.

Specified by:
getRolesList in interface PortalSecurityManager
Parameters:
user - The user object of the current user
Returns:
String[] A list of roles

getUser

public User getUser(JsonSessionState session,
                    String username,
                    String source)
             throws AuthenticationException
Retrieve the details of a user by username

Specified by:
getUser in interface PortalSecurityManager
Parameters:
username - The username of a user to retrieve
source - The authentication source if known
Returns:
User The user requested
Throws:
AuthenticationException - if any errors occur

logout

public void logout(JsonSessionState session,
                   User user)
            throws AuthenticationException
Logout the provided user

Specified by:
logout in interface PortalSecurityManager
Throws:
AuthenticationException

runSsoIntegration

public boolean runSsoIntegration(JsonSessionState session,
                                 FormData formData)
Wrapper method for other SSO methods provided by the security manager. If desired, the security manager can take care of the integration using the default usage pattern, rather then calling them individually.

Specified by:
runSsoIntegration in interface PortalSecurityManager
Parameters:
session - : The session of the current request
formData - : FormData object for the current request
Returns:
boolean : True if SSO has redirected, in which case no response should be sent by Dispatch, otherwise False.

ssoInit

public String ssoInit(JsonSessionState session)
               throws Exception
Initialize the SSO Service, prepare a login if required

Specified by:
ssoInit in interface PortalSecurityManager
Parameters:
session - The server session data
Throws:
Exception - if any errors occur

ssoCheckUserDetails

public boolean ssoCheckUserDetails(JsonSessionState session)
Get user details from SSO connection and set them in the user session.

Specified by:
ssoCheckUserDetails in interface PortalSecurityManager
Returns:
boolean: Flag whether a user was actually logged in or not.

ssoBuildLogonInterface

public Map<String,Map<String,String>> ssoBuildLogonInterface(JsonSessionState session)
Build a Map of Maps of on-screen string values for each SSO provider. Should be enough to generate a login interface.

Specified by:
ssoBuildLogonInterface in interface PortalSecurityManager
Returns:
Map Containing the data structure of valid SSO interfaces.

ssoGetRemoteLogonURL

public String ssoGetRemoteLogonURL(JsonSessionState session,
                                   String source)
Retrieve the login URL for redirection against a given provider.

Specified by:
ssoGetRemoteLogonURL in interface PortalSecurityManager
Parameters:
String - The SSO source to use
Returns:
String The URL used by the SSO Service for logins

testForSso

public boolean testForSso(JsonSessionState session,
                          String resource,
                          String uri)
Given the provided resource, test whether SSO should be 'aware' of this resource. 'Aware' resources are valid return return points after SSO redirects, so the test should return false on (for examples) static resources and utilities such as atom feeds.

Specified by:
testForSso in interface PortalSecurityManager
Parameters:
session - : The session for this request
resource - : The name of the resource being accessed
uri - : The full URI of the resource if simple matches fail
Returns:
boolean : True if SSO should be evaluated, False otherwise

testTrustToken

public boolean testTrustToken(JsonSessionState session,
                              String token)
Validate the provided trust token.

Specified by:
testTrustToken in interface PortalSecurityManager
Parameters:
token - : The token to validate
Returns:
boolean : True if the token is valid, False otherwise


Copyright © 2009-2012. All Rights Reserved.