Search in sources :

Example 6 with TokenType

use of org.forgerock.openam.sts.TokenType in project OpenAM by OpenRock.

the class SoapSTSInstanceConfig method toJson.

/**
     * @return Provides the json representation of the SoapSTSInstanceConfig instance. The json representation is posted
     * to the sts-publish service to programmatically publish an instance of the soap-sts.
     */
public JsonValue toJson() {
    JsonValue baseValue = super.toJson();
    baseValue.add(DEPLOYMENT_CONFIG, deploymentConfig.toJson());
    JsonValue validatedTokenConfiguration = new JsonValue(new ArrayList<>());
    List<Object> translationList = validatedTokenConfiguration.asList();
    for (TokenValidationConfig tokenValidationConfig : securityPolicyValidatedTokenConfiguration) {
        translationList.add(tokenValidationConfig.toJson());
    }
    baseValue.add(SECURITY_POLICY_VALIDATED_TOKEN_CONFIG, validatedTokenConfiguration);
    baseValue.add(SOAP_KEYSTORE_CONFIG, keystoreConfig != null ? keystoreConfig.toJson() : null);
    //cannot just add the issueTokenTypes set directly to the baseValue because the enclosing enums will not be quoted
    if (issueTokenTypes != null) {
        JsonValue issueTokens = new JsonValue(new HashSet<String>());
        Collection<String> issueCollection = issueTokens.asCollection(String.class);
        for (TokenType tokenType : issueTokenTypes) {
            issueCollection.add(tokenType.name());
        }
        baseValue.add(ISSUE_TOKEN_TYPES, issueTokens);
    }
    baseValue.add(DELEGATION_RELATIONSHIP_SUPPORTED, String.valueOf(delegationRelationshipsSupported));
    baseValue.add(SOAP_DELEGATION_CONFIG, (soapDelegationConfig != null ? soapDelegationConfig.toJson() : null));
    return baseValue;
}
Also used : TokenType(org.forgerock.openam.sts.TokenType) JsonValue(org.forgerock.json.JsonValue)

Example 7 with TokenType

use of org.forgerock.openam.sts.TokenType in project OpenAM by OpenRock.

the class TokenCancelOperationProvider method getFunctionalCancelOperation.

private CancelOperation getFunctionalCancelOperation() {
    TokenCancelOperation tokenCancelOperation = new TokenCancelOperation();
    tokenCancelOperation.setStsProperties(stsPropertiesMBean);
    tokenCancelOperation.setTokenStore(tokenStore);
    try {
        List<TokenCanceller> tokenCancellers = new ArrayList<>();
        for (TokenType tokentype : validatedTokens) {
            tokenCancellers.add(operationFactory.getTokenCanceller(tokentype));
        }
        tokenCancelOperation.setTokenCancellers(tokenCancellers);
    } catch (STSInitializationException e) {
        throw new RuntimeException(e);
    }
    return new TokenCancelOperationWrapper(tokenCancelOperation, threadLocalAMTokenCache);
}
Also used : TokenType(org.forgerock.openam.sts.TokenType) RequestSecurityTokenType(org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType) ArrayList(java.util.ArrayList) TokenCancelOperation(org.apache.cxf.sts.operation.TokenCancelOperation) STSInitializationException(org.forgerock.openam.sts.STSInitializationException) TokenCanceller(org.apache.cxf.sts.token.canceller.TokenCanceller)

Aggregations

TokenType (org.forgerock.openam.sts.TokenType)7 ArrayList (java.util.ArrayList)3 RequestSecurityTokenType (org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType)3 STSInitializationException (org.forgerock.openam.sts.STSInitializationException)3 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 TokenCancelOperation (org.apache.cxf.sts.operation.TokenCancelOperation)1 TokenIssueOperation (org.apache.cxf.sts.operation.TokenIssueOperation)1 TokenValidateOperation (org.apache.cxf.sts.operation.TokenValidateOperation)1 TokenCanceller (org.apache.cxf.sts.token.canceller.TokenCanceller)1 TokenProvider (org.apache.cxf.sts.token.provider.TokenProvider)1 TokenValidator (org.apache.cxf.sts.token.validator.TokenValidator)1 WSSecurityException (org.apache.ws.security.WSSecurityException)1 JsonValue (org.forgerock.json.JsonValue)1 TokenValidationConfig (org.forgerock.openam.sts.soap.config.user.TokenValidationConfig)1