Package demo.sts.provider.token

Examples of demo.sts.provider.token.SAMLTokenIssueOperation$KeyStoreInfo


        verify(requestMock);
    }

    @Test
    public void testIssueDelegateWithInvalidCert2() throws Exception {
        SAMLTokenIssueOperation id = new SAMLTokenIssueOperation();
        assertNotNull(id);

        CertificateFactory certificateFactory = CertificateFactory
                .getInstance("X.509");
        X509Certificate x509Certificate = (X509Certificate) certificateFactory
                    .generateCertificate(new ByteArrayInputStream(Base64Utility
                            .decode(CERT_DATA)));
        JAXBElement<X509Certificate> jX509Certificate = new JAXBElement<X509Certificate>(
                QName.valueOf("X509Certificate"), X509Certificate.class,
                x509Certificate);

        // JAXBElement<byte[]> jX509Certificate = new
        // JAXBElement<byte[]>(QName.valueOf("X509Certificate"), byte[].class,
        // CERT_DATA.getBytes());

        X509DataType x509DataType = new X509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(
                jX509Certificate);
        JAXBElement<X509DataType> jX509DataType = new JAXBElement<X509DataType>(
                QName.valueOf("X509Data"), X509DataType.class, x509DataType);

        KeyInfoType keyInfoType = new KeyInfoType();
        keyInfoType.getContent().add(jX509DataType);
        JAXBElement<KeyInfoType> jKeyInfoType = new JAXBElement<KeyInfoType>(
                QName.valueOf("KeyInfo"), KeyInfoType.class, keyInfoType);

        UseKeyType useKeyType = new UseKeyType();
        useKeyType.setAny(jKeyInfoType);
        JAXBElement<UseKeyType> jUseKeyType = new JAXBElement<UseKeyType>(
                QName.valueOf("UseKey"), UseKeyType.class, useKeyType);

        EasyMock.expect(requestMock.getAny()).andStubReturn(
                Arrays.asList((Object) jUseKeyType));
        EasyMock.replay(requestMock);

        TokenProvider tp1 = new Saml1TokenProvider();
        TokenProvider tp2 = new Saml2TokenProvider();
        id.setTokenProviders(Arrays.asList(tp1, tp2));


        try {
            id.issue(requestMock, null);
            fail("CertificateException should be thrown");
        } catch (Exception e) {
            //expected
        }
View Full Code Here

TOP

Related Classes of demo.sts.provider.token.SAMLTokenIssueOperation$KeyStoreInfo

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.