Package org.picketlink.identity.federation.api.saml.v2.metadata

Examples of org.picketlink.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder


    private static final PicketLinkLogger logger = PicketLinkLoggerFactory.getLogger();

    public static SAMLDocumentHolder parseRedirectBinding(String samlMessage) {
        InputStream is;
        is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
        SAML2Request saml2Request = new SAML2Request();
        try {
            saml2Request.getSAML2ObjectFromStream(is);
            return saml2Request.getSamlDocumentHolder();
        } catch (Exception e) {
            logger.samlBase64DecodingError(e);
        }
        return null;
View Full Code Here


    public static SAMLDocumentHolder parsePostBinding(String samlMessage) {
        InputStream is;
        byte[] samlBytes = PostBindingUtil.base64Decode(samlMessage);
        is = new ByteArrayInputStream(samlBytes);
        SAML2Request saml2Request = new SAML2Request();
        try {
            saml2Request.getSAML2ObjectFromStream(is);
            return saml2Request.getSamlDocumentHolder();
        } catch (Exception e) {
            logger.samlBase64DecodingError(e);
        }
        return null;
    }
View Full Code Here

        Document samlResponseDocument = buildDocument();
        return new PostBindingBuilder(samlResponseDocument);

    }
    public Document buildDocument() throws ProcessingException, ConfigurationException, ParsingException {
        Document document = new SAML2Request().convert(createLogoutRequest());
        if (encrypt) encryptDocument(document);
        return document;
    }
View Full Code Here

        if (encrypt) encryptDocument(document);
        return document;
    }

    private LogoutRequestType createLogoutRequest() throws ConfigurationException {
        LogoutRequestType lort = new SAML2Request().createLogoutRequest(responseIssuer);

        NameIDType nameID = new NameIDType();
        nameID.setValue(userPrincipal);
        //Deal with NameID Format
        String nameIDFormat = JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get();
View Full Code Here

    }

    public SAMLDocumentHolder getSAMLDocumentHolder(String samlMessage) throws ParsingException, ConfigurationException,
            ProcessingException {
        InputStream is = null;
        SAML2Request saml2Request = new SAML2Request();

        try {
            if (redirectProfile) {
                is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
            } else {
                byte[] samlBytes = PostBindingUtil.base64Decode(samlMessage);
                logger.trace("SAML Request Document: " + new String(samlBytes));
                is = new ByteArrayInputStream(samlBytes);
            }
        } catch (Exception rte) {
            logger.samlBase64DecodingError(rte);
            throw logger.parserError(rte);
        }

        saml2Request.getSAML2ObjectFromStream(is);

        return saml2Request.getSamlDocumentHolder();
    }
View Full Code Here

    }

    public RequestAbstractType getSAMLRequest(String samlMessage) throws ParsingException, ConfigurationException,
            ProcessingException {
        InputStream is = null;
        SAML2Request saml2Request = new SAML2Request();
        if (redirectProfile) {
            try {
                is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
            } catch (Exception e) {
                logger.samlParsingError(e);
                throw logger.parserError(e);
            }
        } else {
            byte[] samlBytes = PostBindingUtil.base64Decode(samlMessage);
            logger.trace("SAML Request Document: " + new String(samlBytes));
            is = new ByteArrayInputStream(samlBytes);
        }
        return saml2Request.getRequestType(is);
    }
View Full Code Here

     * @throws IOException
     * @throws GeneralSecurityException
     */
    public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey)
            throws SAXException, IOException, GeneralSecurityException {
        SAML2Request saml2Request = new SAML2Request();

        // Deal with the original request
        StringWriter sw = new StringWriter();

        saml2Request.marshall(authRequest, sw);

        // URL Encode the Request
        String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString());

        String urlEncodedRelayState = null;
View Full Code Here

     */
    public static AuthnRequestType getRequestFromSignedURL(String signedURL) throws ConfigurationException,
            ProcessingException, ParsingException, IOException {
        String samlRequestTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_REQUEST_KEY);

        SAML2Request saml2Request = new SAML2Request();
        return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue));
    }
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testAuthnRequestCreationWithSignature() throws Exception {
        SAML2Request saml2Request = new SAML2Request();
        String id = IDGenerator.create("ID_");
        String assertionConsumerURL = "http://sp";
        String destination = "http://idp";
        String issuerValue = "http://sp";
        AuthnRequestType authnRequest = saml2Request.createAuthnRequestType(id, assertionConsumerURL, destination, issuerValue);

        KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
        KeyPair kp = kpg.genKeyPair();

        SAML2Signature ss = new SAML2Signature();
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testNoKeyInfo() throws Exception {
        SAML2Request saml2Request = new SAML2Request();
        String id = IDGenerator.create("ID_");
        String assertionConsumerURL = "http://sp";
        String destination = "http://idp";
        String issuerValue = "http://sp";
        AuthnRequestType authnRequest = saml2Request.createAuthnRequestType(id, assertionConsumerURL, destination, issuerValue);

        KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
        KeyPair kp = kpg.genKeyPair();

        SAML2Signature ss = new SAML2Signature();
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder

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.