Skip to content

Commit

Permalink
add aws cognito support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Nov 13, 2018
1 parent 553fbc2 commit a55f73d
Show file tree
Hide file tree
Showing 85 changed files with 764 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apereo.cas.configuration.model.support.cassandra.authentication.CassandraAuthenticationProperties;
import org.apereo.cas.configuration.model.support.clouddirectory.CloudDirectoryProperties;
import org.apereo.cas.configuration.model.support.cognito.AmazonCognitoAuthenticationProperties;
import org.apereo.cas.configuration.model.support.couchbase.authentication.CouchbaseAuthenticationProperties;
import org.apereo.cas.configuration.model.support.couchdb.authentication.CouchDbAuthenticationProperties;
import org.apereo.cas.configuration.model.support.digest.DigestProperties;
Expand Down Expand Up @@ -98,6 +99,12 @@ public class AuthenticationProperties implements Serializable {
@NestedConfigurationProperty
private CloudDirectoryProperties cloudDirectory = new CloudDirectoryProperties();

/**
* Configuration settings for cognito authentication.
*/
@NestedConfigurationProperty
private AmazonCognitoAuthenticationProperties cognito = new AmazonCognitoAuthenticationProperties();

/**
* Surrogate authentication settings.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,92 @@ public abstract class BaseAmazonWebServicesProperties implements Serializable {
@RequiredProperty
private String endpoint;

/**
* Maximum connections setting.
*/
private int maxConnections = 10;

/**
* Connection timeout.
*/
private int connectionTimeout = 5000;

/**
* Request timeout.
*/
private int requestTimeout = 5000;

/**
* Socket timeout.
*/
private int socketTimeout = 5000;

/**
* The maximum number of times that a retryable failed request (ex: a 5xx response from a
* service) will be retried. Or -1 if the user has not explicitly set this value, in which case
* the configured RetryPolicy will be used to control the retry count.
*/
private int maxErrorRetry = -1;

/**
* Client execution timeout.
*/
private int clientExecutionTimeout = 10000;

/**
* Flag that indicates whether to use Gzip compression.
*/
private boolean useGzip;

/**
* Flag that indicates whether to use reaper.
*/
private boolean useReaper;

/**
* Flag that indicates whether to throttle retries.
*/
private boolean useThrottleRetries;

/**
* Flag that indicates whether to keep TCP connection alive.
*/
private boolean useTcpKeepAlive;

/**
* Protocol setting.
*/
private String protocol = "HTTPS";

/**
* Optionally specifies the proxy host to connect through.
*/
private String proxyHost;

/**
* Optionally specifies the proxy password to connect through.
*/
private String proxyPassword;

/**
* Optionally specifies the proxy username to connect through.
*/
private String proxyUsername;

/**
* Optionally specifies the proxy port to connect through.
*/
private int proxyPort = -1;

/**
* Flag that indicates whether to cache response metadata.
*/
private boolean cacheResponseMetadata;

/**
* Local address.
*/
private String localAddress;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.apereo.cas.configuration.model.support.cognito;

import org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties;
import org.apereo.cas.configuration.model.core.authentication.PrincipalTransformationProperties;
import org.apereo.cas.configuration.model.support.aws.BaseAmazonWebServicesProperties;
import org.apereo.cas.configuration.support.RequiredProperty;
import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

/**
* This is {@link AmazonCognitoAuthenticationProperties}.
*
* @author Misagh Moayyed
* @since 6.0.0
*/
@RequiresModule(name = "cas-server-support-aws-cognito-authentication")
@Getter
@Setter
public class AmazonCognitoAuthenticationProperties extends BaseAmazonWebServicesProperties {
/**
* The name of the authentication handler.
*/
private String name;

/**
* Password encoding properties.
*/
@NestedConfigurationProperty
private PasswordEncoderProperties passwordEncoder = new PasswordEncoderProperties();

/**
* Principal transformation properties.
*/
@NestedConfigurationProperty
private PrincipalTransformationProperties principalTransformation = new PrincipalTransformationProperties();

/**
* The order of this authentication handler in the chain.
*/
private int order = Integer.MAX_VALUE;

/**
* The application client id, created in Cognito without a secret key.
*/
@RequiredProperty
private String clientId;

/**
* The user pool identifiers where accounts may be located.
*/
@RequiredProperty
private String userPoolId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,65 +41,15 @@ public abstract class AbstractDynamoDbProperties extends BaseAmazonWebServicesPr
*/
private long writeCapacity = 10;

/**
* Connection timeout.
*/
private int connectionTimeout = 5000;

/**
* Request timeout.
*/
private int requestTimeout = 5000;

/**
* Socket timeout.
*/
private int socketTimeout = 5000;

/**
* Flag that indicates whether to use Gzip compression.
*/
private boolean useGzip;

/**
* Flag that indicates whether to use reaper.
*/
private boolean useReaper;

/**
* Flag that indicates whether to throttle retries.
*/
private boolean useThrottleRetries;

/**
* Flag that indicates whether to keep TCP connection alive.
*/
private boolean useTcpKeepAlive;

/**
* Protocol setting.
*/
private String protocol = "HTTPS";

/**
* Client execution timeout.
*/
private int clientExecutionTimeout = 10000;

/**
* Flag that indicates whether to cache response metadata.
*/
private boolean cacheResponseMetadata;

/**
* Local address.
*/
private String localAddress;

/**
* Maximum connections setting.
*/
private int maxConnections = 10;

/**
* Indicates that the database instance is local to the deployment
Expand All @@ -109,30 +59,7 @@ public abstract class AbstractDynamoDbProperties extends BaseAmazonWebServicesPr
*/
private boolean localInstance;

/**
* The maximum number of times that a retryable failed request (ex: a 5xx response from a
* service) will be retried. Or -1 if the user has not explicitly set this value, in which case
* the configured RetryPolicy will be used to control the retry count.
*/
private int maxErrorRetry = -1;

/**
* Optionally specifies the proxy host to connect through.
*/
private String proxyHost;

/**
* Optionally specifies the proxy password to connect through.
*/
private String proxyPassword;

/**
* Optionally specifies the proxy username to connect through.
*/
private String proxyUsername;

/**
* Optionally specifies the proxy port to connect through.
*/
private int proxyPort = -1;
}
2 changes: 1 addition & 1 deletion api/cas-server-core-api-util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

description = "Apereo CAS Core Utility APIs"
dependencies {
api libraries.jose4j
implementation libraries.jose4j
}
3 changes: 2 additions & 1 deletion core/cas-server-core-audit-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ dependencies {

implementation libraries.pac4j
implementation libraries.caffein

implementation libraries.nimbus

implementation project(":core:cas-server-core-web-api")
implementation project(":core:cas-server-core-util-api")
implementation project(":core:cas-server-core-configuration-api")
Expand Down
1 change: 1 addition & 0 deletions core/cas-server-core-audit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {

implementation libraries.pac4j
implementation libraries.caffein
implementation libraries.nimbus

implementation project(":core:cas-server-core-web-api")
implementation project(":core:cas-server-core-util-api")
Expand Down
4 changes: 3 additions & 1 deletion core/cas-server-core-util-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
description = "Apereo CAS Core Utilities"
dependencies {
api libraries.jose4j
implementation libraries.jose4j

api project(":api:cas-server-core-api-authentication")
api project(":api:cas-server-core-api-configuration-model")
api project(":api:cas-server-core-api-ticket")
api project(":api:cas-server-core-api-util")
api project(":api:cas-server-core-api-web")

implementation libraries.pac4j
implementation libraries.nimbus
implementation libraries.springsecurity
implementation libraries.zxingbarcode
implementation libraries.bouncycastle
Expand Down
4 changes: 3 additions & 1 deletion core/cas-server-core-util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
description = "Apereo CAS Core Utilities"

dependencies {
api libraries.jose4j
implementation libraries.jose4j

api project(":api:cas-server-core-api-authentication")
api project(":api:cas-server-core-api-ticket")
api project(":api:cas-server-core-api-util")
Expand All @@ -10,6 +11,7 @@ dependencies {
api project(":core:cas-server-core-util-api")

implementation libraries.pac4j
implementation libraries.nimbus
implementation libraries.zxingbarcode
implementation libraries.bouncycastle

Expand Down
1 change: 1 addition & 0 deletions core/cas-server-core-web-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies {
implementation project(":core:cas-server-core-util-api")

implementation libraries.pac4j
implementation libraries.nimbus
implementation libraries.thymeleaf
implementation libraries.oshi
implementation libraries.cassecurityfilter
Expand Down
1 change: 1 addition & 0 deletions core/cas-server-core-web/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation project(":core:cas-server-core-web-api")

implementation libraries.pac4j
implementation libraries.nimbus
implementation libraries.thymeleaf
implementation libraries.springintegration
}
Expand Down
2 changes: 1 addition & 1 deletion docs/apereo.github.io
Loading

0 comments on commit a55f73d

Please sign in to comment.