Class ConnectorService
- java.lang.Object
-
- org.springframework.extensions.webscripts.connector.ConnectorService
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ConnectorService extends java.lang.Object implements org.springframework.context.ApplicationContextAwareThe ConnectorService acts as a singleton that can be used to build any of the objects utilized by the Connector layer.This class is mounted as a Spring Bean within the Web Script Framework so that developers can access it from the application context.
- Author:
- muzquiano, Kevin Roast
-
-
Constructor Summary
Constructors Constructor Description ConnectorService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticatorgetAuthenticator(java.lang.String id)Returns the implementation of an Authenticator with a given idorg.springframework.extensions.config.ConfigServicegetConfigService()Gets the config service.ConnectorgetConnector(java.lang.String endpointId)Retrieves a Connector to a given endpoint.ConnectorgetConnector(java.lang.String endpointId, java.lang.String userId, javax.servlet.http.HttpSession session)Retrieves a Connector for the given endpoint that is scoped to the given user.ConnectorgetConnector(java.lang.String endpointId, javax.servlet.http.HttpSession session)Retrieves a Connector to a given endpoint.ConnectorgetConnector(java.lang.String endpointId, UserContext userContext, javax.servlet.http.HttpSession session)Retrieves a Connector for the given endpoint that is scoped to the given user context.ConnectorSessiongetConnectorSession(javax.servlet.http.HttpSession session, java.lang.String endpointId)Returns the ConnectorSession bound to the current HttpSession for the given endpointCredentialVaultgetCredentialVault(javax.servlet.http.HttpSession session, java.lang.String userId)Retrieves the user-scoped CredentialVault for the given user If a vault doesn't yet exist, a vault of the default type will be instantiatedCredentialVaultgetCredentialVault(javax.servlet.http.HttpSession session, java.lang.String userId, java.lang.String vaultProviderId)Retrieves the user-scoped CredentialVault for the given user id and given vault idRemoteConfigElementgetRemoteConfig()Return the RemoteConfigElement instancevoidremoveConnectorSession(javax.servlet.http.HttpSession session, java.lang.String endpointId)Removes the ConnectorSession from the HttpSession for the given endpointvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)Sets the Spring application contextvoidsetConfigService(org.springframework.extensions.config.ConfigService configService)Sets the config service.
-
-
-
Method Detail
-
setConfigService
public void setConfigService(org.springframework.extensions.config.ConfigService configService)
Sets the config service.- Parameters:
configService- the new config service
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets the Spring application context- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
applicationContext- the Spring application context
-
getConfigService
public org.springframework.extensions.config.ConfigService getConfigService()
Gets the config service.- Returns:
- the config service
-
getRemoteConfig
public RemoteConfigElement getRemoteConfig()
Return the RemoteConfigElement instance- Returns:
- RemoteConfigElement
-
getConnector
public Connector getConnector(java.lang.String endpointId) throws ConnectorServiceException
Retrieves a Connector to a given endpoint.This Connector has no given user context and will not pass any authentication credentials. Therefore only endpoints that do not require authentication or have "declared" authentication as part of the endpoint config should be used. This Connector also will not manage connector session state. Thus, it is generally less preferred to use these connectors over those provided by getConnector(endpointId, session)
- Parameters:
endpointId- the endpoint id- Returns:
- the connector
- Throws:
ConnectorServiceException
-
getConnector
public Connector getConnector(java.lang.String endpointId, javax.servlet.http.HttpSession session) throws ConnectorServiceException
Retrieves a Connector to a given endpoint.This Connector has no given user context and will not pass any authentication credentials. Therefore only endpoints that do not require authentication or have "declared" authentication as part of the endpoint config should be used. Cookie and token state will be session bound and reusable on subsequent invocations.
- Parameters:
endpointId- the endpoint idsession- the HTTP session- Returns:
- the connector
- Throws:
ConnectorServiceException
-
getConnector
public Connector getConnector(java.lang.String endpointId, java.lang.String userId, javax.servlet.http.HttpSession session) throws ConnectorServiceException
Retrieves a Connector for the given endpoint that is scoped to the given user.If the provided endpoint is configured to use an Authenticator, then the Connector instance returned will be wrapped as an AuthenticatingConnector.
Cookie and token state will be session bound and reusable on subsequent invocations.
- Parameters:
endpointId- the endpoint iduserId- the user id (optional)session- the session- Returns:
- the connector
- Throws:
ConnectorServiceException
-
getConnector
public Connector getConnector(java.lang.String endpointId, UserContext userContext, javax.servlet.http.HttpSession session) throws ConnectorServiceException
Retrieves a Connector for the given endpoint that is scoped to the given user context.A user context is a means of wrapping the Credentials and ConnectorSession objects for a given user. If they are provided, then context will be drawn from them and stored back.
- Parameters:
endpointId- the endpoint iduserContext- the user contextsession- the http session (optional, if present will persist connector session)- Returns:
- the connector
- Throws:
ConnectorServiceException
-
getAuthenticator
public Authenticator getAuthenticator(java.lang.String id) throws ConnectorServiceException
Returns the implementation of an Authenticator with a given id- Parameters:
id- the id- Returns:
- the authenticator
- Throws:
ConnectorServiceException
-
getConnectorSession
public ConnectorSession getConnectorSession(javax.servlet.http.HttpSession session, java.lang.String endpointId)
Returns the ConnectorSession bound to the current HttpSession for the given endpoint- Parameters:
session- the sessionendpointId- the endpoint id- Returns:
- the connector session
-
removeConnectorSession
public void removeConnectorSession(javax.servlet.http.HttpSession session, java.lang.String endpointId)Removes the ConnectorSession from the HttpSession for the given endpoint- Parameters:
session- the sessionendpointId- the endpoint id
-
getCredentialVault
public CredentialVault getCredentialVault(javax.servlet.http.HttpSession session, java.lang.String userId) throws CredentialVaultProviderException
Retrieves the user-scoped CredentialVault for the given user If a vault doesn't yet exist, a vault of the default type will be instantiated- Parameters:
session- HttpSessionuserId- the user id- Returns:
- the credential vault
- Throws:
CredentialVaultProviderException- the credential vault provider exception
-
getCredentialVault
public CredentialVault getCredentialVault(javax.servlet.http.HttpSession session, java.lang.String userId, java.lang.String vaultProviderId) throws CredentialVaultProviderException
Retrieves the user-scoped CredentialVault for the given user id and given vault id- Parameters:
session- HttpSessionuserId- the user idvaultProviderId- the vault provider id- Returns:
- the credential vault
- Throws:
CredentialVaultProviderException- the credential vault provider exception
-
-