当前位置: 首页>>代码示例>>Java>>正文


Java IdaSamlBootstrap.bootstrap方法代码示例

本文整理汇总了Java中uk.gov.ida.saml.core.IdaSamlBootstrap.bootstrap方法的典型用法代码示例。如果您正苦于以下问题:Java IdaSamlBootstrap.bootstrap方法的具体用法?Java IdaSamlBootstrap.bootstrap怎么用?Java IdaSamlBootstrap.bootstrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uk.gov.ida.saml.core.IdaSamlBootstrap的用法示例。


在下文中一共展示了IdaSamlBootstrap.bootstrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Override
public final void run(MatchingServiceAdapterConfiguration configuration, Environment environment) {
    IdaSamlBootstrap.bootstrap();

    environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());

    environment.jersey().register(LocalMetadataResource.class);
    environment.jersey().register(MatchingServiceResource.class);
    environment.jersey().register(UnknownUserAttributeQueryResource.class);

    environment.jersey().register(SamlOverSoapExceptionMapper.class);
    environment.jersey().register(ExceptionExceptionMapper.class);

    MatchingServiceAdapterHealthCheck healthCheck = new MatchingServiceAdapterHealthCheck();
    environment.healthChecks().register(healthCheck.getName(), healthCheck);
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:17,代码来源:MatchingServiceAdapterApplication.java

示例2: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    IdaSamlBootstrap.bootstrap();
    reset(manifestReader);

    final BasicCredential basicCredential = createBasicCredential();
    encrypter = new uk.gov.ida.saml.security.EncrypterFactory().createEncrypter(basicCredential);
    decrypter = new DecrypterFactory().createDecrypter(ImmutableList.of(basicCredential));
    when(encrypterFactory.createEncrypter()).thenReturn(encrypter);
    factory = new AuthnRequestFactory(
        DESTINATION,
        new PrivateKeyStoreFactory().create(TestEntityIds.TEST_RP).getSigningPrivateKey(),
        manifestReader,
        encrypterFactory
    );
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:17,代码来源:AuthnRequestFactoryTest.java

示例3: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    KeyStoreResource verifyHubKeystoreResource = aKeyStoreResource()
        .withCertificate("VERIFY-FEDERATION", aCertificate().withCertificate(METADATA_SIGNING_A_PUBLIC_CERT).build().getCertificate())
        .build();
    verifyHubKeystoreResource.create();
    applicationTestSupport = new DropwizardTestSupport<>(
        VerifyServiceProviderApplication.class,
        "verify-service-provider.yml",
        config("verifyHubConfiguration.environment", "COMPLIANCE_TOOL"),
        config("verifyHubConfiguration.metadata.uri", () -> String.format("http://localhost:%s/SAML2/metadata", wireMockServer.port())),
        config("msaMetadata.uri", msaServer::getUri),
        config("msaMetadata.expectedEntityId", MockMsaServer.MSA_ENTITY_ID),
        config("verifyHubConfiguration.metadata.expectedEntityId", HUB_ENTITY_ID),
        config("verifyHubConfiguration.metadata.trustStore.path", verifyHubKeystoreResource.getAbsolutePath()),
        config("verifyHubConfiguration.metadata.trustStore.password", verifyHubKeystoreResource.getPassword()),
        config("serviceEntityIds", "[\"http://some-service-entity-id\"]"),
        config("samlSigningKey", TEST_RP_PRIVATE_SIGNING_KEY),
        config("samlPrimaryEncryptionKey", TEST_RP_PRIVATE_ENCRYPTION_KEY)
    );

    IdaSamlBootstrap.bootstrap();
    wireMockServer.start();
    msaServer.serveDefaultMetadata();
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:26,代码来源:HubMetadataFeatureTest.java

示例4: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    instantValidator = mock(InstantValidator.class);
    subjectValidator = mock(SubjectValidator.class);
    conditionsValidator = mock(ConditionsValidator.class);
    assertion = mock(Assertion.class);
    AuthnStatement authnStatement = mock(AuthnStatement.class);

    validator = new AssertionValidator(
        instantValidator,
        subjectValidator,
        conditionsValidator
    );

    when(assertion.getAuthnStatements()).thenReturn(ImmutableList.of(authnStatement));

    IdaSamlBootstrap.bootstrap();
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:19,代码来源:AssertionValidatorTest.java

示例5: beforeClass

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
    IdaSamlBootstrap.bootstrap();
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
        .using(jerseyClientConfiguration)
        .build(EidasSessionResourceContractTest.class.getSimpleName());
    sessionId = SessionId.createNewSessionId();
    samlAuthnResponseContainerDto = createAuthnResponseSignedByKeyPair(sessionId, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_CERT, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_PRIVATE_KEY);
    encryptedIdentityAssertion = AssertionBuilder.anAssertion().withId(UUID.randomUUID().toString()).build();
    encryptedIdentityAssertionString = XML_OBJECT_XML_OBJECT_TO_BASE_64_ENCODED_STRING_TRANSFORMER.apply(encryptedIdentityAssertion);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:13,代码来源:EidasSessionResourceContractTest.java

示例6: run

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Override
public final void run(SamlEngineConfiguration configuration, Environment environment) {
    IdaSamlBootstrap.bootstrap();

    environment.getObjectMapper().registerModule(new GuavaModule());
    environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());

    // register resources
    registerResources(environment, configuration);
    
    // register exception mappers
    environment.jersey().register(SamlEngineExceptionMapper.class);

    environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:16,代码来源:SamlEngineApplication.java

示例7: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() throws ResolverException, MarshallingException, SignatureException {
    IdaSamlBootstrap.bootstrap();
    CriteriaSet criteria = new CriteriaSet(new EntityIdCriterion(idpEntityId));
    EntityDescriptor idpEntityDescriptor = anEntityDescriptor().withIdpSsoDescriptor(anIdpSsoDescriptor().withSingleSignOnService(anEndpoint().withLocation(idpSSOUri.toASCIIString()).buildSingleSignOnService()).build()).build();
    when(metadataProvider.resolveSingle(eq(criteria))).thenReturn(idpEntityDescriptor);
    when(metadataProvider.resolveSingle(not(eq(criteria)))).thenReturn(null);

    idpSingleSignOnServiceHelper = new IdpSingleSignOnServiceHelper(metadataProvider);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:11,代码来源:IdpSingleSignOnServiceHelperTest.java

示例8: initialize

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<VerifyServiceProviderConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
        new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
            new EnvironmentVariableSubstitutor(false)
        )
    );
    IdaSamlBootstrap.bootstrap();
    bootstrap.getObjectMapper().setDateFormat(ISO8601DateFormat.getInstance());
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:12,代码来源:VerifyServiceProviderApplication.java

示例9: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    KeyStoreResource verifyHubKeystoreResource = aKeyStoreResource()
        .withCertificate("VERIFY-FEDERATION", aCertificate().withCertificate(METADATA_SIGNING_A_PUBLIC_CERT).build().getCertificate())
        .build();
    verifyHubKeystoreResource.create();
    this.applicationTestSupport = new DropwizardTestSupport<>(
        VerifyServiceProviderApplication.class,
        "verify-service-provider.yml",
        config("verifyHubConfiguration.metadata.uri", () -> String.format("http://localhost:%s/SAML2/metadata", hubServer.port())),
        config("msaMetadata.uri", () -> String.format("http://localhost:%s/matching-service/metadata", wireMockServer.port())),
        config("verifyHubConfiguration.metadata.expectedEntityId", HUB_ENTITY_ID),
        config("msaMetadata.expectedEntityId", MockMsaServer.MSA_ENTITY_ID),
        config("verifyHubConfiguration.metadata.trustStore.path", verifyHubKeystoreResource.getAbsolutePath()),
        config("verifyHubConfiguration.metadata.trustStore.password", verifyHubKeystoreResource.getPassword())
    );

    environmentHelper.setEnv(new HashMap<String, String>() {{
        put("VERIFY_ENVIRONMENT", "COMPLIANCE_TOOL");
        put("MSA_METADATA_URL", "some-msa-metadata-url");
        put("MSA_ENTITY_ID", "some-msa-entity-id");
        put("SERVICE_ENTITY_IDS", "[\"http://some-service-entity-id\"]");
        put("SAML_SIGNING_KEY", TEST_RP_PRIVATE_SIGNING_KEY);
        put("SAML_PRIMARY_ENCRYPTION_KEY", TEST_RP_PRIVATE_ENCRYPTION_KEY);
    }});

    IdaSamlBootstrap.bootstrap();
    wireMockServer.start();
    hubServer.serveDefaultMetadata();
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:31,代码来源:MsaMetadataFeatureTest.java

示例10: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    timeRestrictionValidator = mock(TimeRestrictionValidator.class);
    audienceRestrictionValidator = mock(AudienceRestrictionValidator.class);
    conditions = mock(Conditions.class);

    validator = new ConditionsValidator(timeRestrictionValidator, audienceRestrictionValidator);

    IdaSamlBootstrap.bootstrap();
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:11,代码来源:ConditionsValidatorTest.java

示例11: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setUp() {
    IdaSamlBootstrap.bootstrap();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:5,代码来源:VerifiedAttributesLoggerTest.java

示例12: setUp

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
    IdaSamlBootstrap.bootstrap();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:5,代码来源:IdpAssertionMetricsCollectorTest.java

示例13: setup

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void setup() {
    IdaSamlBootstrap.bootstrap();
    final String idpEntityId = TestEntityIds.STUB_IDP_ONE;
    final String assertionId1 = randomUUID().toString();
    final String assertionId2 = randomUUID().toString();
    final String requestId = randomUUID().toString();
    final SignatureAlgorithm signatureAlgorithm = new SignatureRSASHA1();
    final DigestAlgorithm digestAlgorithm = new DigestSHA256();
    final Subject mdsAssertionSubject = aSubject().withSubjectConfirmation(aSubjectConfirmation().withSubjectConfirmationData(aSubjectConfirmationData().withInResponseTo(requestId).build()).build()).build();
    final AttributeStatement matchingDatasetAttributeStatement = MatchingDatasetAttributeStatementBuilder_1_1.aMatchingDatasetAttributeStatement_1_1().build();
    final Subject authnAssertionSubject = aSubject().withSubjectConfirmation(aSubjectConfirmation().withSubjectConfirmationData(aSubjectConfirmationData().withInResponseTo(requestId).build()).build()).build();
    final AttributeStatement ipAddress = anAttributeStatement().addAttribute(IPAddressAttributeBuilder.anIPAddress().build()).build();
    final Optional<Signature> signature = of(SignatureBuilder.aSignature().build());
    final SignatureImpl signatureImpl = ((SignatureImpl) signature.get());
    signatureImpl.setXMLSignature(BuilderHelper.createXMLSignature(signatureAlgorithm, digestAlgorithm));

    authnStatementAssertion = AssertionBuilder.anAssertion()
            .withId(assertionId1)
            .withIssuer(IssuerBuilder.anIssuer().withIssuerId(idpEntityId).build())
            .withSubject(authnAssertionSubject)
            .addAttributeStatement(ipAddress)
            .addAuthnStatement(AuthnStatementBuilder.anAuthnStatement().build())
            .withSignature(SignatureBuilder.aSignature()
                    .withSignatureAlgorithm(signatureAlgorithm)
                    .withDigestAlgorithm(assertionId1, digestAlgorithm).build())
            .buildUnencrypted();

    matchingDatasetAssertion = AssertionBuilder.anAssertion().withId(assertionId2)
            .withIssuer(IssuerBuilder.anIssuer().withIssuerId(idpEntityId).build())
            .withSubject(mdsAssertionSubject)
            .addAttributeStatement(matchingDatasetAttributeStatement)
            .withSignature(SignatureBuilder.aSignature()
                    .withSignatureAlgorithm(signatureAlgorithm)
                    .withDigestAlgorithm(assertionId2, digestAlgorithm).build())
            .buildUnencrypted();

    when(responseContainer.getSamlResponse()).thenReturn(saml);
    when(stringToOpenSamlResponseTransformer.apply(saml)).thenReturn(samlResponse);
    when(samlResponseToIdaResponseIssuedByIdpTransformer.apply(samlResponse)).thenReturn(responseFromIdp);
    when(authStatementAssertion.getUnderlyingAssertionBlob()).thenReturn(authStatementUnderlyingAssertionBlob);
    when(authStatementAssertion.getAuthnContext()).thenReturn(com.google.common.base.Optional.absent());
    when(authStatementAssertion.getFraudDetectedDetails()).thenReturn(com.google.common.base.Optional.absent());
    when(authStatementAssertion.getPrincipalIpAddressAsSeenByIdp()).thenReturn(com.google.common.base.Optional.of(principalIpAddressSeenByIdp));
    when(authnStatementPersistentId.getNameId()).thenReturn("a name id");
    when(authnStatementPersistentId.getNameId()).thenReturn(persistentIdName);
    when(authStatementAssertion.getPersistentId()).thenReturn(authnStatementPersistentId);
    when(responseFromIdp.getIssuer()).thenReturn(responseIssuer);
    when(responseFromIdp.getStatus()).thenReturn(status);
    when(responseFromIdp.getMatchingDatasetAssertion()).thenReturn(empty());
    when(responseFromIdp.getAuthnStatementAssertion()).thenReturn(empty());
    when(responseFromIdp.getSignature()).thenReturn(signature);;
    when(samlResponse.getIssuer()).thenReturn(issuer);
    when(stringToAssertionTransformer.apply(authStatementUnderlyingAssertionBlob)).thenReturn(authnStatementAssertion);
    when(stringToAssertionTransformer.apply(matchingDatasetUnderlyingAssertionBlob)).thenReturn(matchingDatasetAssertion);

    InboundResponseFromIdpDataGenerator inboundResponseFromIdpDataGenerator = new InboundResponseFromIdpDataGenerator(assertionBlobEncrypter);
    service = new IdpAuthnResponseTranslatorService(
            stringToOpenSamlResponseTransformer,
            stringToAssertionTransformer,
            samlResponseToIdaResponseIssuedByIdpTransformer,
            inboundResponseFromIdpDataGenerator,
            idpAssertionMetricsCollector);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:65,代码来源:IdpAuthnResponseTranslatorServiceTest.java

示例14: bootStrapOpenSaml

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void bootStrapOpenSaml() {
    IdaSamlBootstrap.bootstrap();
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:5,代码来源:GenerateAuthnRequestResourceTest.java

示例15: bootStrapOpenSaml

import uk.gov.ida.saml.core.IdaSamlBootstrap; //导入方法依赖的package包/类
@Before
public void bootStrapOpenSaml() {
    IdaSamlBootstrap.bootstrap();
    reset(manifestReader);
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:6,代码来源:VersionNumberResourceTest.java


注:本文中的uk.gov.ida.saml.core.IdaSamlBootstrap.bootstrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。