Client.java revision 7daa28ae7aca9a3019dbb719cc8428894b412f9f
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]".
*
* Copyright 2014 ForgeRock AS.
*/
/**
* Models a OAuth2 Client.
*
* @since 12.0.0
*/
/**
* Stores the possible OAuth2Client types.
*
* @since 12.0.0
*/
public enum ClientType {
/** Confidential Client Type. */
CONFIDENTIAL("Confidential"),
/** Public Client Type. */
PUBLIC("Public");
/**
* Constructs a new ClientType.
*
* @param type The client type.
*/
}
/**
* Gets the client type.
*
* @return The client type.
*/
return this.type;
}
/**
* Gets the client type from a String.
*
* @param type The String to translate into a client type.
* @return A client type if found, else null.
*/
return clientType;
}
}
}
return null;
}
/**
* {@inheritDoc}
*/
return type;
}
}
/**
* Stores a Client SubjectType.
*
* @since 12.0.0
*/
public enum SubjectType {
/** Pairwise Subject Type. */
PAIRWISE("Pairwise"),
/** Public Subject Type. */
PUBLIC("Public");
/**
* Constructs a new SubjectType.
*
* @param type The subject type.
*/
}
/**
* Gets the subject type.
*
* @return The client subject type.
*/
return this.type;
}
/**
* Translates a String type into a subject type.
*
* @param type The string to translate into a subject type.
* @return A subject type if one is found, else {@code null}.
*/
return subjectType;
}
}
}
return null;
}
/**
* {@inheritDoc}
*/
return type;
}
}
/**
* Stores a client application type.
*
* @since 12.0.0
*/
public enum ApplicationType {
/** Web Application Type. */
WEB("web"),
/** Native Application Type. */
NATIVE("native");
/**
* Constructs a new Application Type.
*
* @param type The type of application.
*/
}
/**
* Gets the client application type.
*
* @return The client application type.
*/
return this.type;
}
/**
* Translates a string into an application type.
*
* @param type The string to translate into a application type.
* @return An application type if found, else {@code null}.
*/
return applicationType;
}
}
}
return null;
}
}
/**
* Creates a OAuth2Client.
* @param clientID The client id of the client.
* @param clientType The client type of the client.
* @param redirectionURIs The redirection uris of the client.
* @param allowedGrantScopes The allowed scopes of the client.
* @param defaultGrantScopes The default scopes of the client.
* @param displayName The display name of the client
* @param displayDescription The client description of the client.
* @param clientName The client name of the client.
* @param subjectType The subject type of the client.
* @param idTokenSignedResponseAlgorithm The id token signed response algorithm of the client.
* @param postLogoutRedirectionURI The post logout redirect uri of the client.
* @param accessToken The registration access token of the client.
* @param clientSessionURI The client session uri of the client.
* @param applicationType The application type of the client.
* @param clientSecret The client secret of the client.
* @param responseTypes the response types of the client.
* @param contacts The contact information for the client (can be null).
*/
public Client(String clientID, String clientType, List<String> redirectionURIs, List<String> allowedGrantScopes,
String postLogoutRedirectionURI, String accessToken, String clientSessionURI, String applicationType,
}
/**
* Gets the client id of the OAuth2Client.
*
* @return The client id.
*/
public String getClientID() {
}
/**
* Sets the client id of the OAuth2Client.
*
* @param clientID The client id.
*/
}
}
/**
* Gets the client type of the OAuth2Client. If the client type is {@code null}, {@code null} is returned.
*
* @return The client type.
*/
public ClientType getClientType() {
return ClientType.fromString(get(OAuth2Constants.ShortClientAttributeNames.CLIENT_TYPE.getType()).asString());
}
/**
* Sets the client type of the OAuth2Client.
*
* @param clientType The client type.
*/
}
}
/**
* Gets the redirection uris of the OAuth2Client. If the redirection uris is {@code null}, {@code null} is
* returned.
*
* @return The redirection uris as URIs.
*/
if (listOfRedirectURIs == null) {
return null;
}
try {
}
} catch (Exception e) {
}
return setOfURIs;
}
/**
* Gets the redirection uris of the OAuth2Client. If the redirection uris is {@code null}, {@code null} is returned.
*
* @return The redirection uris as Strings.
*/
if (get(OAuth2Constants.ShortClientAttributeNames.REDIRECT_URIS.getType()).asList(String.class) != null) {
} else {
return null;
}
}
/**
* Sets the redirection uris of the OAuth2Client.
*
* @param redirectionURIs The redirection uris.
*/
}
}
/**
* Gets the allowed scopes of the OAuth2Client. If the allowed scopes is {@code null}, {@code null} is returned.
*
* @return The allowed scopes.
*/
} else {
return null;
}
}
/**
* Sets the allowed scopes of the OAuth2Client.
*
* @param allowedGrantScopes The allowed scopes.
*/
}
}
/**
* Gets the default scopes of the OAuth2Client. If the default scopes is {@code null}, {@code null}, is returned.
*
* @return The default scopes.
*/
if (get(OAuth2Constants.ShortClientAttributeNames.DEFAULT_SCOPES.getType()).asList(String.class) != null) {
} else {
}
}
/**
* Sets the default scopes of the OAuth2Client.
*
* @param defaultGrantScopes The default scopes.
*/
}
}
/**
* Gets the display names of the OAuth2Client. If the display names is {@code null}, {@code null} is returned.
*
* @return The display names.
*/
if (get(OAuth2Constants.ShortClientAttributeNames.DISPLAY_NAME.getType()).asList(String.class) != null) {
} else {
return null;
}
}
/**
* Sets the display names of the OAuth2Client.
*
* @param displayName The display names.
*/
}
}
/**
* Gets the client descriptions of the OAuth2Client. If the client descriptions is {@code null}, {@code null} is
* returned.
*
* @return The client descriptions.
*/
if (get(OAuth2Constants.ShortClientAttributeNames.CLIENT_DESCRIPTION.getType()).asList(String.class) != null) {
return new HashSet<String>(get(OAuth2Constants.ShortClientAttributeNames.CLIENT_DESCRIPTION.getType())
} else {
return null;
}
}
/**
* Sets the client descriptions of the OAuth2Client.
*
* @param displayDescription The client descriptions.
*/
}
}
/**
* Gets the client name of the OAuth2Client. If the client name is {@code null}, {@code null} is returned.
*
* @return The client name.
*/
public String getClientName() {
} else {
return null;
}
}
/**
* Sets the client name of the OAuth2Client.
*
* @param clientName The client name.
*/
}
}
/**
* Gets the subject type of the OAuth2Client. If the subject type is {@code null}, {@code null} is returned.
*
* @return The subject type.
*/
public SubjectType getSubjectType() {
return SubjectType.fromString(get(OAuth2Constants.ShortClientAttributeNames.SUBJECT_TYPE.getType()).asString());
}
/**
* Sets the subject type of the OAuth2Client.
*
* @param subjectType The subject type.
*/
}
}
/**
* Gets the id token signed response alg of the OAuth2Client.
*
* @return The id token signed response alg.
*/
public String getIdTokenSignedResponseAlgorithm() {
return get(OAuth2Constants.ShortClientAttributeNames.ID_TOKEN_SIGNED_RESPONSE_ALG.getType()).asString();
}
/**
* Sets the id token signed response alg of the OAuth2Client.
* <br/>
* If the specified idTokenSignedResponseAlgorithm is {@code null} the value is defaulted to 'HS256'.
*
* @param idTokenSignedResponseAlgorithm The id token signed response alg.
*/
} else {
}
}
/**
* Gets the post logout redirection uri of the OAuth2Client. If the logout redirection uri is {@code null},
* {@code null} is returned.
*
* @return The post logout redirection uri.
*/
public String getPostLogoutRedirectionURI() {
return get(OAuth2Constants.ShortClientAttributeNames.POST_LOGOUT_REDIRECT_URIS.getType()).asString();
}
/**
* Sets the post logout redirection uri of the OAuth2Client.
*
* @param postLogoutRedirectionURI The post logout redirection uri.
*/
}
}
/**
* Gets the registration access token of the OAuth2Client. If the registration access token is {@code null},
* {@code null} is returned.
*
* @return The registration access token.
*/
public String getAccessToken() {
return get(OAuth2Constants.ShortClientAttributeNames.REGISTRATION_ACCESS_TOKEN.getType()).asString();
}
/**
* Sets the registration access token of the OAuth2Client.
*
* @param accessToken The registration access token.
*/
}
}
/**
* Indicates whether this client has a registration access token or not.
*/
public boolean hasAccessToken() {
}
/**
* Gets the client session uri of the OAuth2Client. If the client session uri is {@code null}, {@code null} is
* returned.
*
* @return The client session uri.
*/
public String getClientSessionURI() {
}
/**
* Sets the client session uri of the OAuth2Client.
*
* @param clientSessionURI The client session uri.
*/
}
}
/**
* Gets the application type of the OAuth2Client. If the application type is {@code null}, {@code null} is returned.
*
* @return The application type.
*/
public ApplicationType getApplicationType() {
return ApplicationType.fromString(get(OAuth2Constants.ShortClientAttributeNames.APPLICATION_TYPE.getType())
.asString());
}
/**
* Sets the application type of the OAuth2Client.
*
* @param applicationType The application type.
*/
}
}
/**
* Gets the client secret of the OAuth2Client. If the client secret is {@code null}, {@code null} is returned.
*
* @return The client's secret.
*/
public String getClientSecret() {
}
/**
* Sets the client secret of the OAuth2Client.
*
* @param clientSecret The client's secret.
*/
}
}
/**
* Gets the response types. If the response types value is {@code null}, {@code null} will be returned.
*
* @return A {@code Set} of response types.
*/
if (get(OAuth2Constants.ShortClientAttributeNames.RESPONSE_TYPES.getType()).asList(String.class) != null) {
} else {
return null;
}
}
/**
* Sets the response types of the OAuth2Client.
*
* @param responseTypes The response types.
*/
}
}
/**
* Gets the contacts. If the contacts value is {@code null}, {@code null} will be returned.
*
* @return A {@code Set} of contacts
*/
} else {
return null;
}
}
/**
* Sets the contacts of the OAuth2Client.
*
* @param contacts The contacts.
*/
}
}
}