com.metamatrix.platform.security.membership.service
Class MembershipServiceImpl

java.lang.Object
  extended by com.metamatrix.platform.security.membership.service.MembershipServiceImpl
All Implemented Interfaces:
ApplicationService, MembershipServiceInterface

public class MembershipServiceImpl
extends java.lang.Object
implements MembershipServiceInterface

This class serves as the primary implementation of the Membership Service, and logically consists of a set of one or more MembershipDomainInterface instances. The Service is responsible for creating and intializing the set of domains, receiving requests from clients, and determining which domain or domains are to handle those requests.


Field Summary
 
Fields inherited from interface com.metamatrix.platform.security.api.service.MembershipServiceInterface
ADMIN_HOSTS, ADMIN_PASSWORD, ADMIN_USERNAME, AT, DEFAULT_ADMIN_USERNAME, DEFAULT_WSDL_USERNAME, DOMAIN_ACTIVE, DOMAIN_NAME, DOMAIN_ORDER, DOMAIN_PROPERTIES, NAME, SECURITY_ENABLED
 
Constructor Summary
MembershipServiceImpl(java.net.URL dqpURL, java.net.InetAddress hostAddress)
           
 
Method Summary
 AuthenticationToken authenticateUser(java.lang.String username, Credentials credential, java.io.Serializable trustedPayload, java.lang.String applicationName)
          Authenticate a user with the specified username and credential for use with the specified application.
 java.util.List getDomainNames()
           
protected  java.util.List getDomains()
           
 java.util.Set getGroupNames()
          Obtain the collection of group names.
 java.util.Set<java.lang.String> getGroupsForDomain(java.lang.String domainName)
           
 java.util.Set getGroupsForUser(java.lang.String userName)
          Obtain the set of groups to which this user belongs to.
 MetaMatrixPrincipal getPrincipal(MetaMatrixPrincipalName principal)
          Obtain the principal object that is representative of the principal
 void initialize(java.util.Properties env)
          Perform initialization and commence processing.
 boolean isSecurityEnabled()
           
 boolean isSuperUser(java.lang.String username)
           
 boolean isWsdlUser(java.lang.String username)
           
 void start(ApplicationEnvironment environment)
          Start the service with the specified environment.
 void stop()
          Stop the service.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MembershipServiceImpl

public MembershipServiceImpl(java.net.URL dqpURL,
                             java.net.InetAddress hostAddress)
Method Detail

initialize

public void initialize(java.util.Properties env)
                throws ApplicationInitializationException
Perform initialization and commence processing. This method is called only once.

Note: In order to perform the chaining of membership domains, this method assumes there exists a property in the given environment properties named DOMAIN_ORDER that has an ordered value in the form of "A, X, ..., D"

Specified by:
initialize in interface ApplicationService
Parameters:
env - Initialialization properties
Throws:
ApplicationInitializationException

authenticateUser

public AuthenticationToken authenticateUser(java.lang.String username,
                                            Credentials credential,
                                            java.io.Serializable trustedPayload,
                                            java.lang.String applicationName)
Authenticate a user with the specified username and credential for use with the specified application. The application name may also be used by the Membership Service to determine the appropriate authentication mechanism.

This method iterates through the domains and, on each domain, attempts to authenticate the principal with the specified credentials. Authentication is successful upon the first domain encountered that authenticates the principals.

Specified by:
authenticateUser in interface MembershipServiceInterface
Parameters:
username -
credential -
trustedPayload -
applicationName -
Returns:
Throws:
MetaMatrixSecurityException
MembershipServiceException

getPrincipal

public MetaMatrixPrincipal getPrincipal(MetaMatrixPrincipalName principal)
                                 throws MembershipServiceException,
                                        InvalidPrincipalException
Obtain the principal object that is representative of the principal

Specified by:
getPrincipal in interface MembershipServiceInterface
Parameters:
principalName -
type -
Returns:
Throws:
MetaMatrixSecurityException
InvalidPrincipalException
MembershipServiceException

getGroupsForUser

public java.util.Set getGroupsForUser(java.lang.String userName)
                               throws MembershipServiceException,
                                      InvalidPrincipalException
Obtain the set of groups to which this user belongs to. The result will come from the first domain that has the specified user.

Specified by:
getGroupsForUser in interface MembershipServiceInterface
Returns:
a set of Strings
Throws:
MembershipServiceException
InvalidPrincipalException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getGroupNames

public java.util.Set getGroupNames()
                            throws MembershipServiceException
Description copied from interface: MembershipServiceInterface
Obtain the collection of group names.

Specified by:
getGroupNames in interface MembershipServiceInterface
Throws:
MembershipServiceException
See Also:
MembershipServiceInterface.getGroupNames()

getDomains

protected java.util.List getDomains()
Returns:
Returns the domains.

getDomainNames

public java.util.List getDomainNames()
Specified by:
getDomainNames in interface MembershipServiceInterface

getGroupsForDomain

public java.util.Set<java.lang.String> getGroupsForDomain(java.lang.String domainName)
                                                   throws MembershipServiceException
Specified by:
getGroupsForDomain in interface MembershipServiceInterface
Throws:
MembershipServiceException

isSuperUser

public boolean isSuperUser(java.lang.String username)
Specified by:
isSuperUser in interface MembershipServiceInterface

isWsdlUser

public boolean isWsdlUser(java.lang.String username)

isSecurityEnabled

public boolean isSecurityEnabled()
                          throws MembershipServiceException
Specified by:
isSecurityEnabled in interface MembershipServiceInterface
Throws:
MembershipServiceException
See Also:
MembershipServiceInterface.isSecurityEnabled()

start

public void start(ApplicationEnvironment environment)
           throws ApplicationLifecycleException
Description copied from interface: ApplicationService
Start the service with the specified environment. The environment can be used to find other services or resources.

Specified by:
start in interface ApplicationService
Parameters:
environment - Environment
Throws:
ApplicationLifecycleException - If an error occurs while starting

stop

public void stop()
          throws ApplicationLifecycleException
Description copied from interface: ApplicationService
Stop the service.

Specified by:
stop in interface ApplicationService
Throws:
ApplicationLifecycleException - If an error occurs while starting


Copyright © 2009. All Rights Reserved.