com.amazonaws.services.ssooidc.model.CreateTokenRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ssooidc Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.ssooidc.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateTokenRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*
*/
private String clientId;
/**
*
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*
*/
private String clientSecret;
/**
*
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values,
* depending on the grant type that you want:
*
*
* * Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* * Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*
*/
private String grantType;
/**
*
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify this
* authorization request. This comes from the result of the StartDeviceAuthorization API.
*
*/
private String deviceCode;
/**
*
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify
* this authorization request. This grant type is currently unsupported for the CreateToken API.
*
*/
private String code;
/**
*
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
*
* For more information about the features and limitations of the current IAM Identity Center OIDC implementation,
* see Considerations for Using this Guide in the IAM Identity Center OIDC API
* Reference.
*
*/
private String refreshToken;
/**
*
* The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes
* that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured
* for the client during the call to RegisterClient.
*
*/
private java.util.List scope;
/**
*
* Used only when calling this API for the Authorization Code grant type. This value specifies the location of the
* client or application that has registered to receive the authorization code.
*
*/
private String redirectUri;
/**
*
* Used only when calling this API for the Authorization Code grant type. This value is generated by the client and
* presented to validate the original code challenge value the client passed at authorization time.
*
*/
private String codeVerifier;
/**
*
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*
*
* @param clientId
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
*
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*
*
* @return The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*/
public String getClientId() {
return this.clientId;
}
/**
*
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
*
*
* @param clientId
* The unique identifier string for the client or application. This value comes from the result of the
* RegisterClient API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withClientId(String clientId) {
setClientId(clientId);
return this;
}
/**
*
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*
*
* @param clientSecret
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*/
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
/**
*
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*
*
* @return A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*/
public String getClientSecret() {
return this.clientSecret;
}
/**
*
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
*
*
* @param clientSecret
* A secret string generated for the client. This value should come from the persisted result of the
* RegisterClient API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withClientSecret(String clientSecret) {
setClientSecret(clientSecret);
return this;
}
/**
*
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values,
* depending on the grant type that you want:
*
*
* * Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* * Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*
*
* @param grantType
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following
* values, depending on the grant type that you want:
*
* Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*/
public void setGrantType(String grantType) {
this.grantType = grantType;
}
/**
*
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values,
* depending on the grant type that you want:
*
*
* * Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* * Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*
*
* @return Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following
* values, depending on the grant type that you want:
*
* Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*/
public String getGrantType() {
return this.grantType;
}
/**
*
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values,
* depending on the grant type that you want:
*
*
* * Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* * Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
*
*
* @param grantType
* Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following
* values, depending on the grant type that you want:
*
* Device Code - urn:ietf:params:oauth:grant-type:device_code
*
*
* Refresh Token - refresh_token
*
*
* For information about how to obtain the device code, see the StartDeviceAuthorization topic.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withGrantType(String grantType) {
setGrantType(grantType);
return this;
}
/**
*
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify this
* authorization request. This comes from the result of the StartDeviceAuthorization API.
*
*
* @param deviceCode
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify
* this authorization request. This comes from the result of the StartDeviceAuthorization API.
*/
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
/**
*
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify this
* authorization request. This comes from the result of the StartDeviceAuthorization API.
*
*
* @return Used only when calling this API for the Device Code grant type. This short-term code is used to identify
* this authorization request. This comes from the result of the StartDeviceAuthorization API.
*/
public String getDeviceCode() {
return this.deviceCode;
}
/**
*
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify this
* authorization request. This comes from the result of the StartDeviceAuthorization API.
*
*
* @param deviceCode
* Used only when calling this API for the Device Code grant type. This short-term code is used to identify
* this authorization request. This comes from the result of the StartDeviceAuthorization API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withDeviceCode(String deviceCode) {
setDeviceCode(deviceCode);
return this;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify
* this authorization request. This grant type is currently unsupported for the CreateToken API.
*
*
* @param code
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to
* identify this authorization request. This grant type is currently unsupported for the CreateToken
* API.
*/
public void setCode(String code) {
this.code = code;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify
* this authorization request. This grant type is currently unsupported for the CreateToken API.
*
*
* @return Used only when calling this API for the Authorization Code grant type. The short-term code is used to
* identify this authorization request. This grant type is currently unsupported for the CreateToken
* API.
*/
public String getCode() {
return this.code;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify
* this authorization request. This grant type is currently unsupported for the CreateToken API.
*
*
* @param code
* Used only when calling this API for the Authorization Code grant type. The short-term code is used to
* identify this authorization request. This grant type is currently unsupported for the CreateToken
* API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withCode(String code) {
setCode(code);
return this;
}
/**
*
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
*
* For more information about the features and limitations of the current IAM Identity Center OIDC implementation,
* see Considerations for Using this Guide in the IAM Identity Center OIDC API
* Reference.
*
*
* @param refreshToken
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
* For more information about the features and limitations of the current IAM Identity Center OIDC
* implementation, see Considerations for Using this Guide in the IAM Identity Center
* OIDC API Reference.
*/
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
/**
*
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
*
* For more information about the features and limitations of the current IAM Identity Center OIDC implementation,
* see Considerations for Using this Guide in the IAM Identity Center OIDC API
* Reference.
*
*
* @return Used only when calling this API for the Refresh Token grant type. This token is used to refresh
* short-term tokens, such as the access token, that might expire.
*
* For more information about the features and limitations of the current IAM Identity Center OIDC
* implementation, see Considerations for Using this Guide in the IAM Identity Center
* OIDC API Reference.
*/
public String getRefreshToken() {
return this.refreshToken;
}
/**
*
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
*
* For more information about the features and limitations of the current IAM Identity Center OIDC implementation,
* see Considerations for Using this Guide in the IAM Identity Center OIDC API
* Reference.
*
*
* @param refreshToken
* Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term
* tokens, such as the access token, that might expire.
*
* For more information about the features and limitations of the current IAM Identity Center OIDC
* implementation, see Considerations for Using this Guide in the IAM Identity Center
* OIDC API Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withRefreshToken(String refreshToken) {
setRefreshToken(refreshToken);
return this;
}
/**
*
* The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes
* that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured
* for the client during the call to RegisterClient.
*
*
* @return The list of scopes for which authorization is requested. The access token that is issued is limited to
* the scopes that are granted. If this value is not specified, IAM Identity Center authorizes all scopes
* that are configured for the client during the call to RegisterClient.
*/
public java.util.List getScope() {
return scope;
}
/**
*
* The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes
* that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured
* for the client during the call to RegisterClient.
*
*
* @param scope
* The list of scopes for which authorization is requested. The access token that is issued is limited to the
* scopes that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that
* are configured for the client during the call to RegisterClient.
*/
public void setScope(java.util.Collection scope) {
if (scope == null) {
this.scope = null;
return;
}
this.scope = new java.util.ArrayList(scope);
}
/**
*
* The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes
* that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured
* for the client during the call to RegisterClient.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setScope(java.util.Collection)} or {@link #withScope(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param scope
* The list of scopes for which authorization is requested. The access token that is issued is limited to the
* scopes that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that
* are configured for the client during the call to RegisterClient.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withScope(String... scope) {
if (this.scope == null) {
setScope(new java.util.ArrayList(scope.length));
}
for (String ele : scope) {
this.scope.add(ele);
}
return this;
}
/**
*
* The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes
* that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured
* for the client during the call to RegisterClient.
*
*
* @param scope
* The list of scopes for which authorization is requested. The access token that is issued is limited to the
* scopes that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that
* are configured for the client during the call to RegisterClient.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withScope(java.util.Collection scope) {
setScope(scope);
return this;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value specifies the location of the
* client or application that has registered to receive the authorization code.
*
*
* @param redirectUri
* Used only when calling this API for the Authorization Code grant type. This value specifies the location
* of the client or application that has registered to receive the authorization code.
*/
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value specifies the location of the
* client or application that has registered to receive the authorization code.
*
*
* @return Used only when calling this API for the Authorization Code grant type. This value specifies the location
* of the client or application that has registered to receive the authorization code.
*/
public String getRedirectUri() {
return this.redirectUri;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value specifies the location of the
* client or application that has registered to receive the authorization code.
*
*
* @param redirectUri
* Used only when calling this API for the Authorization Code grant type. This value specifies the location
* of the client or application that has registered to receive the authorization code.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withRedirectUri(String redirectUri) {
setRedirectUri(redirectUri);
return this;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value is generated by the client and
* presented to validate the original code challenge value the client passed at authorization time.
*
*
* @param codeVerifier
* Used only when calling this API for the Authorization Code grant type. This value is generated by the
* client and presented to validate the original code challenge value the client passed at authorization
* time.
*/
public void setCodeVerifier(String codeVerifier) {
this.codeVerifier = codeVerifier;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value is generated by the client and
* presented to validate the original code challenge value the client passed at authorization time.
*
*
* @return Used only when calling this API for the Authorization Code grant type. This value is generated by the
* client and presented to validate the original code challenge value the client passed at authorization
* time.
*/
public String getCodeVerifier() {
return this.codeVerifier;
}
/**
*
* Used only when calling this API for the Authorization Code grant type. This value is generated by the client and
* presented to validate the original code challenge value the client passed at authorization time.
*
*
* @param codeVerifier
* Used only when calling this API for the Authorization Code grant type. This value is generated by the
* client and presented to validate the original code challenge value the client passed at authorization
* time.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateTokenRequest withCodeVerifier(String codeVerifier) {
setCodeVerifier(codeVerifier);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getClientId() != null)
sb.append("ClientId: ").append(getClientId()).append(",");
if (getClientSecret() != null)
sb.append("ClientSecret: ").append("***Sensitive Data Redacted***").append(",");
if (getGrantType() != null)
sb.append("GrantType: ").append(getGrantType()).append(",");
if (getDeviceCode() != null)
sb.append("DeviceCode: ").append(getDeviceCode()).append(",");
if (getCode() != null)
sb.append("Code: ").append(getCode()).append(",");
if (getRefreshToken() != null)
sb.append("RefreshToken: ").append("***Sensitive Data Redacted***").append(",");
if (getScope() != null)
sb.append("Scope: ").append(getScope()).append(",");
if (getRedirectUri() != null)
sb.append("RedirectUri: ").append(getRedirectUri()).append(",");
if (getCodeVerifier() != null)
sb.append("CodeVerifier: ").append("***Sensitive Data Redacted***");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateTokenRequest == false)
return false;
CreateTokenRequest other = (CreateTokenRequest) obj;
if (other.getClientId() == null ^ this.getClientId() == null)
return false;
if (other.getClientId() != null && other.getClientId().equals(this.getClientId()) == false)
return false;
if (other.getClientSecret() == null ^ this.getClientSecret() == null)
return false;
if (other.getClientSecret() != null && other.getClientSecret().equals(this.getClientSecret()) == false)
return false;
if (other.getGrantType() == null ^ this.getGrantType() == null)
return false;
if (other.getGrantType() != null && other.getGrantType().equals(this.getGrantType()) == false)
return false;
if (other.getDeviceCode() == null ^ this.getDeviceCode() == null)
return false;
if (other.getDeviceCode() != null && other.getDeviceCode().equals(this.getDeviceCode()) == false)
return false;
if (other.getCode() == null ^ this.getCode() == null)
return false;
if (other.getCode() != null && other.getCode().equals(this.getCode()) == false)
return false;
if (other.getRefreshToken() == null ^ this.getRefreshToken() == null)
return false;
if (other.getRefreshToken() != null && other.getRefreshToken().equals(this.getRefreshToken()) == false)
return false;
if (other.getScope() == null ^ this.getScope() == null)
return false;
if (other.getScope() != null && other.getScope().equals(this.getScope()) == false)
return false;
if (other.getRedirectUri() == null ^ this.getRedirectUri() == null)
return false;
if (other.getRedirectUri() != null && other.getRedirectUri().equals(this.getRedirectUri()) == false)
return false;
if (other.getCodeVerifier() == null ^ this.getCodeVerifier() == null)
return false;
if (other.getCodeVerifier() != null && other.getCodeVerifier().equals(this.getCodeVerifier()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getClientId() == null) ? 0 : getClientId().hashCode());
hashCode = prime * hashCode + ((getClientSecret() == null) ? 0 : getClientSecret().hashCode());
hashCode = prime * hashCode + ((getGrantType() == null) ? 0 : getGrantType().hashCode());
hashCode = prime * hashCode + ((getDeviceCode() == null) ? 0 : getDeviceCode().hashCode());
hashCode = prime * hashCode + ((getCode() == null) ? 0 : getCode().hashCode());
hashCode = prime * hashCode + ((getRefreshToken() == null) ? 0 : getRefreshToken().hashCode());
hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode());
hashCode = prime * hashCode + ((getRedirectUri() == null) ? 0 : getRedirectUri().hashCode());
hashCode = prime * hashCode + ((getCodeVerifier() == null) ? 0 : getCodeVerifier().hashCode());
return hashCode;
}
@Override
public CreateTokenRequest clone() {
return (CreateTokenRequest) super.clone();
}
}