• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Attribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.saml.saml2.core.Attribute的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Attribute类属于org.opensaml.saml.saml2.core包,在下文中一共展示了Attribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newAttributeStatement

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
/**
 * New attribute statement.
 *
 * @param attributes            the attributes
 * @param setFriendlyName       the set friendly name
 * @param configuredNameFormats the configured name formats
 * @return the attribute statement
 */
public AttributeStatement newAttributeStatement(final Map<String, Object> attributes,
                                                final boolean setFriendlyName,
                                                final Map<String, String> configuredNameFormats) {
    final AttributeStatement attrStatement = newSamlObject(AttributeStatement.class);
    for (final Map.Entry<String, Object> e : attributes.entrySet()) {
        if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
            LOGGER.info("Skipping attribute [{}] because it does not have any values.", e.getKey());
            continue;
        }
        final Attribute attribute = newAttribute(setFriendlyName, e, configuredNameFormats);
        attrStatement.getAttributes().add(attribute);
    }

    return attrStatement;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:24,代码来源:AbstractSaml20ObjectBuilder.java


示例2: shouldReturnRequiredCycle3AttributesWhenValuesExistInCycle3Assertion

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnRequiredCycle3AttributesWhenValuesExistInCycle3Assertion(){
    List<Attribute> accountCreationAttributes = Arrays.asList(CYCLE_3).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    ImmutableMap<String, String> build = ImmutableMap.<String, String>builder().put("cycle3Key", "cycle3Value").build();
    Cycle3Dataset cycle3Dataset = Cycle3Dataset.createFromData(build);
    HubAssertion hubAssertion =new HubAssertion("1", "issuerId", DateTime.now(), new PersistentId("1"), null, Optional.of(cycle3Dataset));

    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, null, Optional.of(hubAssertion));

    List<Attribute> cycle_3 = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("cycle_3")).collect(toList());
    StringBasedMdsAttributeValue personName = (StringBasedMdsAttributeValue) cycle_3.get(0).getAttributeValues().get(0);

    assertThat(cycle_3.size()).isEqualTo(1);
    assertThat(personName.getValue().equals("cycle3Value"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:19,代码来源:UserAccountCreationAttributeExtractorTest.java


示例3: getStringAttributeValue

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
private static Optional<String> getStringAttributeValue(List<Attribute> attributes, String attributeName) {
    final Optional<Attribute> attribute = getAttribute(attributes, attributeName);
    return attribute.map(attr -> {
        StringValueSamlObject attributeValue = ((StringValueSamlObject) attr.getAttributeValues().get(0));
        return Optional.ofNullable(attributeValue.getValue()).orElse("");
    });
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:8,代码来源:AttributeTranslationService.java


示例4: shouldReturnFullAddressHistoryIncludingWhetherTheyAreVerified

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnFullAddressHistoryIncludingWhetherTheyAreVerified() throws Exception {
    List<Attribute> accountCreationAttributes = Arrays.asList(ADDRESS_HISTORY).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    Address currentAddress = new Address(Arrays.asList("line1", "line2", "line3"), "postCode", "internationalPostCode", "uprn", null, null, true);
    Address oldAddress = new Address(Arrays.asList("old_line1", "old_line2", "old_line3"), "old_postCode", "old_internationalPostCode", "old_uprn", new DateTime(1990, 1, 30, 0, 0), new DateTime(2000, 1, 29, 0, 0), false);
    Address oldAddress2 = new Address(Arrays.asList("old_line1", "old_line2", "old_line3"), "old_postCode_2", "old_internationalPostCode_2", "old_uprn", new DateTime(2000, 1, 30, 0, 0), new DateTime(2010, 1, 29, 0, 0), true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withCurrentAddresses(singletonList(currentAddress)).withPreviousAddresses(Arrays.asList(oldAddress, oldAddress2)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    Attribute addressHistoryAttribute = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("addresshistory")).collect(toList()).get(0);
    List<AddressImpl> addresses = addressHistoryAttribute.getAttributeValues().stream().map(v -> (AddressImpl) v).collect(toList());

    AddressImpl firstAddress = addresses.stream().filter(a -> a.getPostCode().getValue().equals("postCode")).findFirst().get();
    AddressImpl secondAddress = addresses.stream().filter(a -> a.getPostCode().getValue().equals("old_postCode")).findFirst().get();
    AddressImpl thirdAddress = addresses.stream().filter(a -> a.getPostCode().getValue().equals("old_postCode_2")).findFirst().get();

    assertThat(addresses.size()).isEqualTo(3);
    assertThat(firstAddress.getVerified()).isTrue();
    assertThat(secondAddress.getVerified()).isFalse();
    assertThat(thirdAddress.getVerified()).isTrue();
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:26,代码来源:UserAccountCreationAttributeExtractorTest.java


示例5: handle

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
public OutboundResponseFromUnknownUserCreationService handle(InboundMatchingServiceRequest attributeQuery) {
    IdentityProviderAssertion matchingDatasetAssertion = attributeQuery.getMatchingDatasetAssertion();
    IdentityProviderAssertion authnStatementAssertion = attributeQuery.getAuthnStatementAssertion();
    final String hashedPid = userIdHashFactory.hashId(matchingDatasetAssertion.getIssuerId(),
        matchingDatasetAssertion.getPersistentId().getNameId(),
        authnStatementAssertion.getAuthnStatement().transform(IdentityProviderAuthnStatement::getAuthnContext));

    LevelOfAssuranceDto levelOfAssurance = AuthnContextToLevelOfAssuranceDtoMapper.map(attributeQuery.getAuthnStatementAssertion().getAuthnStatement().get().getAuthnContext());
    UnknownUserCreationResponseDto unknownUserCreationResponseDto = matchingServiceProxy.makeUnknownUserCreationRequest(new UnknownUserCreationRequestDto(hashedPid, levelOfAssurance));
    if (unknownUserCreationResponseDto.getResult().equalsIgnoreCase(UnknownUserCreationResponseDto.FAILURE)) {
        return OutboundResponseFromUnknownUserCreationService.createFailure(attributeQuery.getId(), matchingServiceAdapterConfiguration.getEntityId());
    }

    Optional<MatchingDataset> matchingDataset = attributeQuery.getMatchingDatasetAssertion().getMatchingDataset();
    List<Attribute> extractedUserAccountCreationAttributes = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(
            attributeQuery.getUserCreationAttributes(),
            matchingDataset,
            attributeQuery.getCycle3AttributeAssertion());

    final OutboundResponseFromUnknownUserCreationService matchingServiceResponse = getMatchingServiceResponse(attributeQuery, hashedPid, extractedUserAccountCreationAttributes);
    LOG.info(MessageFormat.format("Result from unknown attribute query request for id {0} is {1}", attributeQuery.getId(), matchingServiceResponse.getStatus()));

    return matchingServiceResponse;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:25,代码来源:UnknownUserAttributeQueryHandler.java


示例6: getMatchingServiceResponse

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
private OutboundResponseFromUnknownUserCreationService getMatchingServiceResponse(
    final String hashPid,
    final InboundMatchingServiceRequest attributeQuery,
    final List<Attribute> userAttributesForAccountCreation) {
    AssertionRestrictions assertionRestrictions = new AssertionRestrictions(
        DateTime.now().plus(assertionLifetimeConfiguration.getAssertionLifetime().toMilliseconds()),
        attributeQuery.getId(),
        attributeQuery.getAssertionConsumerServiceUrl());

    MatchingServiceAssertion assertion = matchingServiceAssertionFactory.createAssertionFromMatchingService(
        new PersistentId(hashPid),
        matchingServiceAdapterConfiguration.getEntityId(),
        assertionRestrictions,
        attributeQuery.getAuthnStatementAssertion().getAuthnStatement().get().getAuthnContext(),
        attributeQuery.getAuthnRequestIssuerId(),
        userAttributesForAccountCreation);
    return OutboundResponseFromUnknownUserCreationService.createSuccess(
        assertion,
        attributeQuery.getId(),
        matchingServiceAdapterConfiguration.getEntityId()
    );
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:23,代码来源:UnknownUserAttributeQueryHandler.java


示例7: InboundMatchingServiceRequest

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
public InboundMatchingServiceRequest(
        String id,
        String issuer,
        IdentityProviderAssertion matchingDatasetAssertion,
        IdentityProviderAssertion authnStatementAssertion,
        Optional<HubAssertion> cycle3AttributeAssertion,
        DateTime issueInstant,
        String authnRequestIssuerId,
        String assertionConsumerServiceUrl,
        List<Attribute> userCreationAttributes) {


    super(id, issuer, issueInstant, null);

    this.matchingDatasetAssertion = matchingDatasetAssertion;
    this.authnStatementAssertion = authnStatementAssertion;
    this.cycle3AttributeAssertion = cycle3AttributeAssertion;
    this.authnRequestIssuerId = authnRequestIssuerId;
    this.assertionConsumerServiceUrl = assertionConsumerServiceUrl;
    this.userCreationAttributes = userCreationAttributes;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:22,代码来源:InboundMatchingServiceRequest.java


示例8: extractEidasMatchingDataset

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
private EidasMatchingDatasetDto extractEidasMatchingDataset(List<Attribute> attributes) {
    LocalDate dob = getAttributeValue(attributes, Eidas_Attributes.DateOfBirth.NAME, DateOfBirth::getDateOfBirth);
    String givenName = getAttributeValue(attributes, Eidas_Attributes.FirstName.NAME, CurrentGivenName::getFirstName);
    String familyName = getAttributeValue(attributes, Eidas_Attributes.FamilyName.NAME, CurrentFamilyName::getFamilyName);
    String birthName = getAttributeValue(attributes, Eidas_Attributes.BirthName.NAME, BirthName::getBirthName);
    String placeOfBirth = getAttributeValue(attributes, Eidas_Attributes.PlaceOfBirth.NAME, PlaceOfBirth::getPlaceOfBirth);
    String gender = getAttributeValue(attributes, Eidas_Attributes.Gender.NAME, Gender::getValue);

    return new EidasMatchingDatasetDto(null,
        dob,
        givenName,
        familyName,
        birthName,
        gender,
        placeOfBirth
    );
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:18,代码来源:EidasMatchingRequestToMSRequestTransformer.java


示例9: shouldReturnCurrentAddressWhetherItIsVerifiedOrNot

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnCurrentAddressWhetherItIsVerifiedOrNot() {
    List<Attribute> accountCreationAttributes = singletonList(UserAccountCreationAttribute.CURRENT_ADDRESS).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());


    Address currentAddress = new Address(Arrays.asList("line1", "line2", "line3"), "postCode", "internationalPostCode", "uprn", null, null, false);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withCurrentAddresses(singletonList(currentAddress)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> addresses = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("currentaddress")).collect(toList());
    AddressImpl addressName = (AddressImpl) addresses.get(0).getAttributeValues().get(0);

    assertThat(addresses.size()).isEqualTo(1);
    assertThat(addressName.getPostCode().equals("postCode"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:19,代码来源:UserAccountCreationAttributeExtractorTest.java


示例10: shouldReturnFailureResponseWhenAttributesRequestedDoNotExist

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnFailureResponseWhenAttributesRequestedDoNotExist(){
    List<Attribute> requiredAttributes = asList(FIRST_NAME, MIDDLE_NAME).stream()
            .map(userAccountCreationAttribute -> new AttributeQueryAttributeFactory(new OpenSamlXmlObjectFactory()).createAttribute(userAccountCreationAttribute))
            .collect(toList());

    AttributeQuery attributeQuery = anAttributeQuery()
            .withId(REQUEST_ID)
            .withAttributes(requiredAttributes)
            .withIssuer(anIssuer().withIssuerId(applicationRule.getConfiguration().getHubEntityId()).build())
            .withSubject(aSubjectWithAssertions(asList(
                    anAuthnStatementAssertion(),
                    assertionWithOnlyFirstName()), REQUEST_ID, HUB_ENTITY_ID))
            .build();

    Response response = makeAttributeQueryRequest(UNKNOWN_USER_URI, attributeQuery, signatureAlgorithmForHub, digestAlgorithmForHub, HUB_ENTITY_ID);
    List<Assertion> decryptedAssertions = assertionDecrypter.decryptAssertions(response::getEncryptedAssertions);

    assertThat(response.getStatus().getStatusCode().getValue()).isEqualTo(RESPONDER);
    Assertions.assertThat(decryptedAssertions).hasSize(0);
    Assertions.assertThat(response.getInResponseTo()).isEqualTo(REQUEST_ID);
    Assertions.assertThat(response.getIssuer().getValue()).isEqualTo(TEST_RP_MS);
    assertThat(response).is(signedBy(TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PRIVATE_SIGNING_KEY));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:25,代码来源:UserAccountCreationAppRuleTest.java


示例11: shouldReturnVerifiedIfAllCurrentAttributeValuesAreVerified

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnVerifiedIfAllCurrentAttributeValuesAreVerified() throws Exception {
    List<Attribute> accountCreationAttributes = Arrays.asList(SURNAME, SURNAME_VERIFIED).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());


    SimpleMdsValue<String> currentSurname = new SimpleMdsValue<>("CurrentSurname", null, null, true);
    SimpleMdsValue<String> oldSurname1 = new SimpleMdsValue<>("OldSurname1", new DateTime(2000, 1, 30, 0, 0), new DateTime(2010, 1, 30, 0, 0), true);
    SimpleMdsValue<String> oldSurname2 = new SimpleMdsValue<>("OldSurname2", new DateTime(1990, 1, 30, 0, 0), new DateTime(2000, 1, 29, 0, 0), true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withSurnameHistory(Arrays.asList(oldSurname1, oldSurname2, currentSurname)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> surnames = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname")).collect(toList());
    List<Attribute>  verified = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname_verified")).collect(toList());
    PersonNameImpl personName = (PersonNameImpl) surnames.get(0).getAttributeValues().get(0);

    assertThat(surnames.size()).isEqualTo(1);
    assertThat(personName.getValue().equals("CurrentSurname"));
    assertThat(verified.size()).isEqualTo(1);
    assertThat(verified.get(0).getName().equals("surname_verified"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:24,代码来源:UserAccountCreationAttributeExtractorTest.java


示例12: assertThatResponseContainsExpectedUserCreationAttributes

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
private void assertThatResponseContainsExpectedUserCreationAttributes(List<AttributeStatement>  attributeStatements, final List<Attribute> expectedUserCreationAttributes) {
    assertThat(attributeStatements).hasSize(1);
    AttributeStatement attributeStatement = attributeStatements.get(0);
    assertThat(attributeStatement.getAttributes()).hasSameSizeAs(expectedUserCreationAttributes);

    for (final Attribute expectedUserCreationAttribute : expectedUserCreationAttributes) {
        Attribute actualAttribute = attributeStatement.getAttributes().stream()
                .filter(attribute -> expectedUserCreationAttribute.getName().equals(attribute.getName()))
                .findFirst()
                .get();

        assertThat(actualAttribute.getAttributeValues()).hasSameSizeAs(expectedUserCreationAttribute.getAttributeValues());
        if (!actualAttribute.getAttributeValues().isEmpty()) {
            assertThatAttributeValuesAreEqual(actualAttribute.getAttributeValues().get(0), expectedUserCreationAttribute.getAttributeValues().get(0));
        }
    }
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:18,代码来源:UserAccountCreationAppRuleTest.java


示例13: givenAValidAttributeQuery

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
private AttributeQuery givenAValidAttributeQuery() {
    AttributeQuery query = openSamlXmlObjectFactory.createAttributeQuery();

    query.setIssueInstant(DateTime.now());
    Subject originalSubject = openSamlXmlObjectFactory.createSubject();
    NameID originalSubjectNameId = openSamlXmlObjectFactory.createNameId("name_id");
    Issuer originalIssuer = openSamlXmlObjectFactory.createIssuer("issuer_id");
    originalSubject.setNameID(originalSubjectNameId);

    SubjectConfirmation subjectConfirmation = openSamlXmlObjectFactory.createSubjectConfirmation();
    originalSubject.getSubjectConfirmations().add(subjectConfirmation);
    query.setSubject(originalSubject);
    query.setIssuer(originalIssuer);

    originalIssuer.setValue("original issuer");
    query.setID("original id");
    originalSubjectNameId.setValue("original subject id");
    originalSubjectNameId.setSPNameQualifier("http://foo.com");

    List<Attribute> attributes = query.getAttributes();
    AttributeFactory_1_1 attributeFactory = new AttributeFactory_1_1(openSamlXmlObjectFactory);
    attributes.add(attributeFactory.createFirstnameAttribute(ImmutableList.of(new SimpleMdsValue<>(FIRST_NAME, null, null, false))));

    return query;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:26,代码来源:InboundMatchingServiceRequestUnmarshallerTest.java


示例14: shouldNotReturnAttributesWhenNoCurrentValueExistsInMatchingDataSet

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldNotReturnAttributesWhenNoCurrentValueExistsInMatchingDataSet() {
    List<Attribute> accountCreationAttributes = singletonList(SURNAME).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    SimpleMdsValue<String> oldSurname1 = new SimpleMdsValue<>("OldSurname1", new DateTime(2000, 1, 30, 0, 0), new DateTime(2010, 1, 30, 0, 0), true);
    SimpleMdsValue<String> oldSurname2 = new SimpleMdsValue<>("OldSurname2", new DateTime(1990, 1, 30, 0, 0), new DateTime(2000, 1, 29, 0, 0), true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withSurnameHistory(Arrays.asList(oldSurname1, oldSurname2)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> surnames = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname")).collect(toList());

    assertThat(surnames.size()).isEqualTo(0);
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:17,代码来源:UserAccountCreationAttributeExtractorTest.java


示例15: createAssertionFromMatchingService

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void createAssertionFromMatchingService() {
    IdGenerator idGenerator = mock(IdGenerator.class);
    AssertionRestrictions assertionRestrictions = mock(AssertionRestrictions.class);
    MatchingServiceAssertionFactory factory = new MatchingServiceAssertionFactory(idGenerator);
    AuthnContext authnContext = AuthnContext.LEVEL_4;
    List<Attribute> userAccountCreationAttributes = Arrays.asList(mock(Attribute.class));

    PersistentId thePersistentId = new PersistentId("thePersistentId");
    MatchingServiceAssertion assertionFromMatchingService = factory.createAssertionFromMatchingService(
        thePersistentId,
        "theIssuerId",
        assertionRestrictions,
        authnContext,
        "theAudience",
        userAccountCreationAttributes
    );

    assertThat(assertionFromMatchingService.getPersistentId(), sameInstance(thePersistentId));
    assertThat(assertionFromMatchingService.getIssuerId(), equalTo("theIssuerId"));
    assertThat(assertionFromMatchingService.getAssertionRestrictions(), sameInstance(assertionRestrictions));
    assertThat(assertionFromMatchingService.getAuthnStatement().getAuthnContext(), sameInstance(authnContext));
    assertThat(assertionFromMatchingService.getAudience(), equalTo("theAudience"));
    assertThat(assertionFromMatchingService.getUserAttributesForAccountCreation(), sameInstance(userAccountCreationAttributes));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:26,代码来源:MatchingServiceAssertionFactoryTest.java


示例16: shouldReturnCurrentSurnamesWhenMatchingDatasetHasListOfSurnames

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnCurrentSurnamesWhenMatchingDatasetHasListOfSurnames() {
    List<Attribute> accountCreationAttributes = singletonList(SURNAME).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    SimpleMdsValue<String> currentSurname = new SimpleMdsValue<>("CurrentSurname", null, null, true);
    SimpleMdsValue<String> oldSurname1 = new SimpleMdsValue<>("OldSurname1", new DateTime(2000, 1, 30, 0, 0), new DateTime(2010, 1, 30, 0, 0), true);
    SimpleMdsValue<String> oldSurname2 = new SimpleMdsValue<>("OldSurname2", new DateTime(1990, 1, 30, 0, 0), new DateTime(2000, 1, 29, 0, 0), true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withSurnameHistory(Arrays.asList(oldSurname1, oldSurname2, currentSurname)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> surnames = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname")).collect(toList());
    PersonNameImpl personName = (PersonNameImpl) surnames.get(0).getAttributeValues().get(0);

    assertThat(surnames.size()).isEqualTo(1);
    assertThat(personName.getValue().equals("CurrentSurname"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:20,代码来源:UserAccountCreationAttributeExtractorTest.java


示例17: shouldReturnCurrentAddressWhenMatchingDatasetHasListOfAddresses

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnCurrentAddressWhenMatchingDatasetHasListOfAddresses() {
    List<Attribute> accountCreationAttributes = singletonList(UserAccountCreationAttribute.CURRENT_ADDRESS).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());


    Address currentAddress = new Address(Arrays.asList("line1", "line2", "line3"), "postCode", "internationalPostCode", "uprn", null, null, true);
    Address oldAddress = new Address(Arrays.asList("old_line1", "old_line2", "old_line3"), "old_postCode", "old_internationalPostCode", "old_uprn", new DateTime(1990, 1, 30, 0, 0), new DateTime(2000, 1, 29, 0, 0), true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withCurrentAddresses(singletonList(currentAddress)).withPreviousAddresses(Arrays.asList(oldAddress)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> addresses = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("currentaddress")).collect(toList());
    AddressImpl addressName = (AddressImpl) addresses.get(0).getAttributeValues().get(0);

    assertThat(addresses.size()).isEqualTo(1);
    assertThat(addressName.getPostCode().equals("postCode"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:20,代码来源:UserAccountCreationAttributeExtractorTest.java


示例18: shouldReturnCurrentSurnameWhetherItIsVerifiedOrNot

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnCurrentSurnameWhetherItIsVerifiedOrNot() {
    List<Attribute> accountCreationAttributes = singletonList(SURNAME).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    SimpleMdsValue<String> currentSurname = new SimpleMdsValue<>("CurrentSurname", null, null, false);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().withSurnameHistory(singletonList(currentSurname)).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> surnames = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname")).collect(toList());
    PersonNameImpl personName = (PersonNameImpl) surnames.get(0).getAttributeValues().get(0);

    assertThat(surnames.size()).isEqualTo(1);
    assertThat(personName.getValue().equals("CurrentSurname"));
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:18,代码来源:UserAccountCreationAttributeExtractorTest.java


示例19: shouldReturnRequiredAttributesForAccountCreationWithoutAttributeWhichIsMissingInMatchingDataSet

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
@Test
public void shouldReturnRequiredAttributesForAccountCreationWithoutAttributeWhichIsMissingInMatchingDataSet(){
    List<Attribute> accountCreationAttributes = Arrays.asList(SURNAME, FIRST_NAME).stream()
            .map(attributeQueryAttributeFactory::createAttribute)
            .collect(toList());

    SimpleMdsValue<String> surname = new SimpleMdsValue<>("CurrentSurname", null, null, true);

    MatchingDataset matchingDataset = MatchingDatasetBuilder.aMatchingDataset().addSurname(surname).build();
    List<Attribute> userAttributesForAccountCreation = userAccountCreationAttributeExtractor.getUserAccountCreationAttributes(accountCreationAttributes, Optional.of(matchingDataset), absent());

    List<Attribute> attributes = userAttributesForAccountCreation.stream().filter(a -> a.getName().equals("surname")).collect(toList());

    assertThat(attributes.size()).isEqualTo(1);
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:16,代码来源:UserAccountCreationAttributeExtractorTest.java


示例20: formatAttributes

import org.opensaml.saml.saml2.core.Attribute; //导入依赖的package包/类
public static String formatAttributes(
    String issuer,
    LevelOfAssurance levelOfAssurance,
    List<Attribute> attributes
) throws JsonProcessingException {
    AttributeStatementLogData attributeStatementLogDto = new AttributeStatementLogData(
        issuer,
        levelOfAssurance,
        getAttributesData(attributes)
    );
    return new ObjectMapper().writeValueAsString(attributeStatementLogDto);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:13,代码来源:VerifiedAttributesLogger.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DtoFactory类代码示例发布时间:2022-05-23
下一篇:
Java JSON类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap