org.springframework.security.oauth2.provider
Class BaseClientDetails

java.lang.Object
  extended by org.springframework.security.oauth2.provider.BaseClientDetails
All Implemented Interfaces:
Serializable, ClientDetails

public class BaseClientDetails
extends Object
implements ClientDetails

Base implementation of ClientDetails.

Author:
Ryan Heaton, Dave Syer
See Also:
Serialized Form

Nested Class Summary
static class BaseClientDetails.ArrayOrStringDeserializer
           
 
Constructor Summary
BaseClientDetails()
           
BaseClientDetails(ClientDetails prototype)
           
BaseClientDetails(String clientId, String resourceIds, String scopes, String grantTypes, String authorities)
           
BaseClientDetails(String clientId, String resourceIds, String scopes, String grantTypes, String authorities, String redirectUris)
           
 
Method Summary
 void addAdditionalInformation(String key, Object value)
           
 boolean equals(Object obj)
           
 Integer getAccessTokenValiditySeconds()
          The access token validity period for this client.
 Map<String,Object> getAdditionalInformation()
          Additional information for this client, not neeed by the vanilla OAuth protocol but might be useful, for example, for storing descriptive information.
 Collection<org.springframework.security.core.GrantedAuthority> getAuthorities()
          Get the authorities that are granted to the OAuth client.
 Set<String> getAuthorizedGrantTypes()
          The grant types for which this client is authorized.
 String getClientId()
          The client id.
 String getClientSecret()
          The client secret.
 Integer getRefreshTokenValiditySeconds()
          The refresh token validity period for this client.
 Set<String> getRegisteredRedirectUri()
          The pre-defined redirect URI for this client to use during the "authorization_code" access grant.
 Set<String> getResourceIds()
          The resources that this client can access.
 Set<String> getScope()
          The scope of this client.
 int hashCode()
           
 boolean isScoped()
          Whether this client is limited to a specific scope.
 boolean isSecretRequired()
          Whether a secret is required to authenticate this client.
 void setAccessTokenValiditySeconds(Integer accessTokenValiditySeconds)
           
 void setAdditionalInformation(Map<String,?> additionalInformation)
           
 void setAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
           
 void setAuthorizedGrantTypes(Collection<String> authorizedGrantTypes)
           
 void setClientId(String clientId)
           
 void setClientSecret(String clientSecret)
           
 void setRefreshTokenValiditySeconds(Integer refreshTokenValiditySeconds)
           
 void setRegisteredRedirectUri(Set<String> registeredRedirectUris)
           
 void setResourceIds(Collection<String> resourceIds)
           
 void setScope(Collection<String> scope)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseClientDetails

public BaseClientDetails()

BaseClientDetails

public BaseClientDetails(ClientDetails prototype)

BaseClientDetails

public BaseClientDetails(String clientId,
                         String resourceIds,
                         String scopes,
                         String grantTypes,
                         String authorities)

BaseClientDetails

public BaseClientDetails(String clientId,
                         String resourceIds,
                         String scopes,
                         String grantTypes,
                         String authorities,
                         String redirectUris)
Method Detail

getClientId

public String getClientId()
Description copied from interface: ClientDetails
The client id.

Specified by:
getClientId in interface ClientDetails
Returns:
The client id.

setClientId

public void setClientId(String clientId)

isSecretRequired

public boolean isSecretRequired()
Description copied from interface: ClientDetails
Whether a secret is required to authenticate this client.

Specified by:
isSecretRequired in interface ClientDetails
Returns:
Whether a secret is required to authenticate this client.

getClientSecret

public String getClientSecret()
Description copied from interface: ClientDetails
The client secret. Ignored if the secret isn't required.

Specified by:
getClientSecret in interface ClientDetails
Returns:
The client secret.

setClientSecret

public void setClientSecret(String clientSecret)

isScoped

public boolean isScoped()
Description copied from interface: ClientDetails
Whether this client is limited to a specific scope. If false, the scope of the authentication request will be ignored.

Specified by:
isScoped in interface ClientDetails
Returns:
Whether this client is limited to a specific scope.

getScope

public Set<String> getScope()
Description copied from interface: ClientDetails
The scope of this client. Empty if the client isn't scoped.

Specified by:
getScope in interface ClientDetails
Returns:
The scope of this client.

setScope

public void setScope(Collection<String> scope)

getResourceIds

public Set<String> getResourceIds()
Description copied from interface: ClientDetails
The resources that this client can access. Can be ignored by callers if empty.

Specified by:
getResourceIds in interface ClientDetails
Returns:
The resources of this client.

setResourceIds

public void setResourceIds(Collection<String> resourceIds)

getAuthorizedGrantTypes

public Set<String> getAuthorizedGrantTypes()
Description copied from interface: ClientDetails
The grant types for which this client is authorized.

Specified by:
getAuthorizedGrantTypes in interface ClientDetails
Returns:
The grant types for which this client is authorized.

setAuthorizedGrantTypes

public void setAuthorizedGrantTypes(Collection<String> authorizedGrantTypes)

getRegisteredRedirectUri

public Set<String> getRegisteredRedirectUri()
Description copied from interface: ClientDetails
The pre-defined redirect URI for this client to use during the "authorization_code" access grant. See OAuth spec, section 4.1.1.

Specified by:
getRegisteredRedirectUri in interface ClientDetails
Returns:
The pre-defined redirect URI for this client.

setRegisteredRedirectUri

public void setRegisteredRedirectUri(Set<String> registeredRedirectUris)

getAuthorities

public Collection<org.springframework.security.core.GrantedAuthority> getAuthorities()
Description copied from interface: ClientDetails
Get the authorities that are granted to the OAuth client. Note that these are NOT the authorities that are granted to the user with an authorized access token. Instead, these authorities are inherent to the client itself.

Specified by:
getAuthorities in interface ClientDetails
Returns:
The authorities.

setAuthorities

public void setAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)

getAccessTokenValiditySeconds

public Integer getAccessTokenValiditySeconds()
Description copied from interface: ClientDetails
The access token validity period for this client. Null if not set explicitly (implementations might use that fact to provide a default value for instance).

Specified by:
getAccessTokenValiditySeconds in interface ClientDetails
Returns:
the access token validity period

setAccessTokenValiditySeconds

public void setAccessTokenValiditySeconds(Integer accessTokenValiditySeconds)

getRefreshTokenValiditySeconds

public Integer getRefreshTokenValiditySeconds()
Description copied from interface: ClientDetails
The refresh token validity period for this client. Zero or negative for default value set by token service.

Specified by:
getRefreshTokenValiditySeconds in interface ClientDetails
Returns:
the refresh token validity period

setRefreshTokenValiditySeconds

public void setRefreshTokenValiditySeconds(Integer refreshTokenValiditySeconds)

setAdditionalInformation

public void setAdditionalInformation(Map<String,?> additionalInformation)

getAdditionalInformation

public Map<String,Object> getAdditionalInformation()
Description copied from interface: ClientDetails
Additional information for this client, not neeed by the vanilla OAuth protocol but might be useful, for example, for storing descriptive information.

Specified by:
getAdditionalInformation in interface ClientDetails
Returns:
a map of additional information

addAdditionalInformation

public void addAdditionalInformation(String key,
                                     Object value)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.