Package org.apache.xml.security.stax.impl.securityToken

Examples of org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken


        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here


        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here

        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here

    @Override
    public InboundSecurityToken validate(final AbstractSecurityContextTokenType securityContextTokenType,
                                                 final String identifier, final TokenContext tokenContext)
            throws WSSecurityException {

        AbstractInboundSecurityToken securityContextToken = new AbstractInboundSecurityToken(
                tokenContext.getWsSecurityContext(), identifier,
                WSSecurityTokenConstants.KeyIdentifier_ExternalReference, true) {

            @Override
            public boolean isAsymmetric() {
                return false;
            }

            @Override
            public Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
                              String correlationID) throws XMLSecurityException {

                Key key = getSecretKey().get(algorithmURI);
                if (key != null) {
                    return key;
                }

                WSPasswordCallback passwordCallback = new WSPasswordCallback(
                        identifier, WSPasswordCallback.SECURITY_CONTEXT_TOKEN);
                WSSUtils.doSecretKeyCallback(
                        tokenContext.getWssSecurityProperties().getCallbackHandler(), passwordCallback, null);
                if (passwordCallback.getKey() == null) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE,
                            "noKey", securityContextTokenType.getId());
                }
                String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(algorithmURI);
                key = new SecretKeySpec(passwordCallback.getKey(), keyAlgorithm);
                setSecretKey(algorithmURI, key);
                return key;
            }

            @Override
            public WSSecurityTokenConstants.TokenType getTokenType() {
                return WSSecurityTokenConstants.SecurityContextToken;
            }
        };

        securityContextToken.setElementPath(tokenContext.getElementPath());
        securityContextToken.setXMLSecEvent(tokenContext.getFirstXMLSecEvent());

        return securityContextToken;
    }
View Full Code Here

                if (this.securityToken != null) {
                    return this.securityToken;
                }

                this.securityToken = new AbstractInboundSecurityToken(
                        inboundSecurityContext, encryptedKeyType.getId(),
                        SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {

                    private byte[] decryptedKey = null;
View Full Code Here

        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here

        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here

        X509SecurityTokenImpl x509SecurityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
        x509SecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
        x509SecurityToken.setElementPath(bstPath);

        AbstractInboundSecurityToken ekSecurityToken = new AbstractInboundSecurityToken(
                null, IDGenerator.generateID(null),
                SecurityTokenConstants.KeyIdentifier_EncryptedKey, true) {
            @Override
            public SecurityTokenConstants.TokenType getTokenType() {
                return SecurityTokenConstants.EncryptedKeyToken;
            }
        };
        ekSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
        ekSecurityToken.setKeyWrappingToken(x509SecurityToken);
        ekSecurityToken.setElementPath(ekPath);

        x509SecurityToken.addWrappedToken(ekSecurityToken);

        X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
        x509TokenSecurityEvent.setSecurityToken(x509SecurityToken);
View Full Code Here

    @Override
    public InboundSecurityToken validate(final AbstractSecurityContextTokenType securityContextTokenType,
                                                 final String identifier, final TokenContext tokenContext)
            throws WSSecurityException {

        AbstractInboundSecurityToken securityContextToken = new AbstractInboundSecurityToken(
                tokenContext.getWsSecurityContext(), identifier,
                WSSecurityTokenConstants.KeyIdentifier_ExternalReference, true) {

            @Override
            public boolean isAsymmetric() {
                return false;
            }

            @Override
            public Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
                              String correlationID) throws XMLSecurityException {

                Key key = getSecretKey().get(algorithmURI);
                if (key != null) {
                    return key;
                }

                WSPasswordCallback passwordCallback = new WSPasswordCallback(
                        identifier, WSPasswordCallback.Usage.SECURITY_CONTEXT_TOKEN);
                WSSUtils.doSecretKeyCallback(
                        tokenContext.getWssSecurityProperties().getCallbackHandler(), passwordCallback, null);
                if (passwordCallback.getKey() == null) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE,
                            "noKey", securityContextTokenType.getId());
                }
                String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(algorithmURI);
                key = new SecretKeySpec(passwordCallback.getKey(), keyAlgorithm);
                setSecretKey(algorithmURI, key);
                return key;
            }

            @Override
            public WSSecurityTokenConstants.TokenType getTokenType() {
                return WSSecurityTokenConstants.SecurityContextToken;
            }
        };

        securityContextToken.setElementPath(tokenContext.getElementPath());
        securityContextToken.setXMLSecEvent(tokenContext.getFirstXMLSecEvent());

        return securityContextToken;
    }
View Full Code Here

            final byte[] subjectSecretKey = SAMLUtil.getSecretKeyFromCallbackHandler(
                    samlAssertionWrapper.getId(), wssSecurityProperties.getCallbackHandler());

            if (subjectSecretKey != null && subjectSecretKey.length > 0) {

                subjectSecurityToken = new AbstractInboundSecurityToken(
                        wsInboundSecurityContext, IDGenerator.generateID(null),
                        WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true) {
                    @Override
                    public WSSecurityTokenConstants.TokenType getTokenType() {
                        return WSSecurityTokenConstants.DefaultToken;
View Full Code Here

TOP

Related Classes of org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.