Class CognitoOidcConfiguration
- All Implemented Interfaces:
OidcConfiguration
Amazon Cognito is a standalone user directory service that provides:
- User sign-up and sign-in
- Multi-factor authentication (MFA)
- Social identity providers (Google, Facebook, etc.)
- OIDC and OAuth 2.0 support
- Built-in hosted UI
Important: Cognito and IAM Identity Center are separate systems. Use CognitoOidcConfiguration for Cognito User Pools, and IdentityCenterOidcConfiguration for IAM Identity Center.
Cognito OIDC Endpoints:
- Authorization: https://{domain}.auth.{region}.amazoncognito.com/oauth2/authorize
- Token: https://{domain}.auth.{region}.amazoncognito.com/oauth2/token
- UserInfo: https://{domain}.auth.{region}.amazoncognito.com/oauth2/userInfo
- JWKS: https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-known/jwks.json
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the admin group name for role mapping.Returns the OIDC authorization endpoint.Returns the OAuth 2.0 client ID.Returns the AWS Secrets Manager ARN for the client secret.Returns the Cognito domain.Returns the claim name for group membership.Returns the OIDC issuer URL.Returns the OIDC JWKS (JSON Web Key Set) endpoint.Returns the OIDC provider type.Returns the redirect URL for this application.Returns the AWS region.Returns the OAuth 2.0 scopes requested by this application.Returns the OIDC token endpoint.Returns the OIDC userinfo endpoint.Returns the claim name for username mapping.Returns the Cognito User Pool ID.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.cloudforge.core.interfaces.OidcConfiguration
getAdditionalProperties, getApplicationUrl, getDeveloperGroupName, getEmailClaim, getFullNameClaim, getLogoutEndpoint, getViewerGroupName, isAutoCreateUsers, isGroupBasedAccessEnabled, usePkce
-
Constructor Details
-
CognitoOidcConfiguration
public CognitoOidcConfiguration(String region, String userPoolId, String domain, String clientId, String clientSecretArn, String redirectUrl, String adminGroupName) Creates a Cognito OIDC configuration.- Parameters:
region- AWS region (e.g., us-east-1)userPoolId- Cognito User Pool ID (e.g., us-east-1_abcdef123)domain- Cognito domain prefix or custom domain (e.g., myapp or auth.example.com)clientId- OAuth 2.0 client IDclientSecretArn- Secrets Manager ARN for client secretredirectUrl- Application callback URLadminGroupName- Admin group name for role mapping
-
-
Method Details
-
getProviderType
Description copied from interface:OidcConfigurationReturns the OIDC provider type.- Specified by:
getProviderTypein interfaceOidcConfiguration- Returns:
- provider type (cognito, identity-center, external)
-
getIssuerUrl
Description copied from interface:OidcConfigurationReturns the OIDC issuer URL. This is the base URL for the OIDC provider.Examples:
- Cognito: https://cognito-idp.{region}.amazonaws.com/{userPoolId}
- Identity Center: https://{tenant}.awsapps.com/start
- Specified by:
getIssuerUrlin interfaceOidcConfiguration- Returns:
- issuer URL
-
getAuthorizationEndpoint
Description copied from interface:OidcConfigurationReturns the OIDC authorization endpoint.This is where users are redirected to authenticate.
- Specified by:
getAuthorizationEndpointin interfaceOidcConfiguration- Returns:
- authorization endpoint URL
-
getTokenEndpoint
Description copied from interface:OidcConfigurationReturns the OIDC token endpoint.This is where applications exchange authorization codes for tokens.
- Specified by:
getTokenEndpointin interfaceOidcConfiguration- Returns:
- token endpoint URL
-
getUserInfoEndpoint
Description copied from interface:OidcConfigurationReturns the OIDC userinfo endpoint.This is where applications retrieve user profile information.
- Specified by:
getUserInfoEndpointin interfaceOidcConfiguration- Returns:
- userinfo endpoint URL
-
getJwksUri
Description copied from interface:OidcConfigurationReturns the OIDC JWKS (JSON Web Key Set) endpoint.This is where applications retrieve public keys to verify JWT signatures.
- Specified by:
getJwksUriin interfaceOidcConfiguration- Returns:
- JWKS endpoint URL
-
getClientId
Description copied from interface:OidcConfigurationReturns the OAuth 2.0 client ID.This is the application identifier registered with the OIDC provider.
- Specified by:
getClientIdin interfaceOidcConfiguration- Returns:
- client ID
-
getClientSecretArn
Description copied from interface:OidcConfigurationReturns the AWS Secrets Manager ARN for the client secret.The client secret is stored securely in AWS Secrets Manager. Applications retrieve it at runtime using IAM permissions.
- Specified by:
getClientSecretArnin interfaceOidcConfiguration- Returns:
- Secrets Manager ARN for client secret
-
getRedirectUrl
Description copied from interface:OidcConfigurationReturns the redirect URL for this application.This is the callback URL where the OIDC provider redirects after authentication. Typically: https://{application-domain}/oauth2/callback or similar.
- Specified by:
getRedirectUrlin interfaceOidcConfiguration- Returns:
- redirect URL
-
getScopes
Description copied from interface:OidcConfigurationReturns the OAuth 2.0 scopes requested by this application.Common scopes: openid, profile, email, groups
- Specified by:
getScopesin interfaceOidcConfiguration- Returns:
- space-separated list of scopes
-
getUsernameClaim
Description copied from interface:OidcConfigurationReturns the claim name for username mapping.This JWT claim is used as the application username.
Common values: preferred_username, email, sub
- Specified by:
getUsernameClaimin interfaceOidcConfiguration- Returns:
- username claim name
-
getGroupsClaim
Description copied from interface:OidcConfigurationReturns the claim name for group membership.This is used for role-based access control in applications.
Common values: cognito:groups, groups
- Specified by:
getGroupsClaimin interfaceOidcConfiguration- Returns:
- groups claim name (optional)
-
getAdminGroupName
Description copied from interface:OidcConfigurationReturns the admin group name for role mapping.Users in this group receive admin privileges in the application.
- Specified by:
getAdminGroupNamein interfaceOidcConfiguration- Returns:
- admin group name (optional)
-
getUserPoolId
Returns the Cognito User Pool ID.- Returns:
- user pool ID
-
getRegion
Returns the AWS region.- Returns:
- region
-
getDomain
Returns the Cognito domain.- Returns:
- domain prefix or custom domain
-
toString
-