Search in sources :

Example 1 with STSType

use of org.picketlink.config.federation.STSType in project wildfly by wildfly.

the class EntityProviderService method configureTokenProviders.

/**
     * <p> Configure the STS Token Providers. </p>
     */
private void configureTokenProviders() {
    STSType stsType = getFederationService().getValue().getStsType();
    if (stsType != null) {
        int tokenTimeout = stsType.getTokenTimeout();
        int clockSkew = stsType.getClockSkew();
        STSType providerStsType = getPicketLinkType().getStsType();
        providerStsType.setTokenTimeout(tokenTimeout);
        providerStsType.setClockSkew(clockSkew);
        List<TokenProviderType> tokenProviders = providerStsType.getTokenProviders().getTokenProvider();
        for (TokenProviderType tokenProviderType : tokenProviders) {
            if (tokenProviderType.getTokenType().equals(JBossSAMLURIConstants.ASSERTION_NSURI.get())) {
                KeyValueType keyValueTypeTokenTimeout = new KeyValueType();
                keyValueTypeTokenTimeout.setKey(GeneralConstants.ASSERTIONS_VALIDITY);
                keyValueTypeTokenTimeout.setValue(String.valueOf(tokenTimeout));
                KeyValueType keyValueTypeClockSkew = new KeyValueType();
                keyValueTypeClockSkew.setKey(GeneralConstants.CLOCK_SKEW);
                keyValueTypeClockSkew.setValue(String.valueOf(clockSkew));
                tokenProviderType.add(keyValueTypeTokenTimeout);
                tokenProviderType.add(keyValueTypeClockSkew);
            }
        }
    }
}
Also used : KeyValueType(org.picketlink.config.federation.KeyValueType) STSType(org.picketlink.config.federation.STSType) TokenProviderType(org.picketlink.config.federation.TokenProviderType)

Example 2 with STSType

use of org.picketlink.config.federation.STSType in project wildfly by wildfly.

the class SAMLAddHandler method toSAMLConfig.

static STSType toSAMLConfig(OperationContext context, ModelNode fromModel) throws OperationFailedException {
    int tokenTimeout = SAMLResourceDefinition.TOKEN_TIMEOUT.resolveModelAttribute(context, fromModel).asInt();
    int clockSkew = SAMLResourceDefinition.CLOCK_SKEW.resolveModelAttribute(context, fromModel).asInt();
    STSType stsType = new STSType();
    stsType.setTokenTimeout(tokenTimeout);
    stsType.setClockSkew(clockSkew);
    return stsType;
}
Also used : STSType(org.picketlink.config.federation.STSType)

Example 3 with STSType

use of org.picketlink.config.federation.STSType in project wildfly by wildfly.

the class EntityProviderService method createSTSType.

private STSType createSTSType() {
    STSType stsType = null;
    InputStream stream = null;
    try {
        URL url = getClass().getClassLoader().getResource("core-sts.xml");
        if (url == null) {
            url = Thread.currentThread().getContextClassLoader().getResource("core-sts");
        }
        if (url != null) {
            stream = url.openStream();
            stsType = (STSType) new STSConfigParser().parse(stream);
        }
    } catch (Exception e) {
        throw PicketLinkLogger.ROOT_LOGGER.federationCouldNotParseSTSConfig(e);
    } finally {
        try {
            if (stream != null) {
                stream.close();
            }
        } catch (IOException ignored) {
        }
    }
    return stsType;
}
Also used : InputStream(java.io.InputStream) STSType(org.picketlink.config.federation.STSType) IOException(java.io.IOException) URL(java.net.URL) ConfigurationException(org.picketlink.common.exceptions.ConfigurationException) StartException(org.jboss.msc.service.StartException) IOException(java.io.IOException) STSConfigParser(org.picketlink.config.federation.parsers.STSConfigParser)

Aggregations

STSType (org.picketlink.config.federation.STSType)3 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 StartException (org.jboss.msc.service.StartException)1 ConfigurationException (org.picketlink.common.exceptions.ConfigurationException)1 KeyValueType (org.picketlink.config.federation.KeyValueType)1 TokenProviderType (org.picketlink.config.federation.TokenProviderType)1 STSConfigParser (org.picketlink.config.federation.parsers.STSConfigParser)1