本文整理汇总了Java中org.opensaml.saml.saml2.core.Issuer类的典型用法代码示例。如果您正苦于以下问题:Java Issuer类的具体用法?Java Issuer怎么用?Java Issuer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Issuer类属于org.opensaml.saml.saml2.core包,在下文中一共展示了Issuer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatAuthnResponse
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public String formatAuthnResponse(Response samlResponse, Direction direction, Boolean validSignature) {
Issuer issuer = samlResponse.getIssuer();
String issuerString = issuer != null ? issuer.getValue() : "";
Status status = samlResponse.getStatus();
StatusCode subStatusCode = status.getStatusCode().getStatusCode();
String subStatus = subStatusCode != null ? subStatusCode.getValue() : "";
return String.format(AUTHN_RESPONSE,
samlResponse.getID(),
samlResponse.getInResponseTo(),
direction,
samlResponse.getDestination(),
issuerString,
validSignature,
status.getStatusCode().getValue(),
subStatus,
getStatusDetailValues(status));
}
示例2: setUpForTranslate
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
private void setUpForTranslate(Optional<AuthnContext> authnContext, Optional<FraudDetectedDetails> fraudDetectedDetails, String underlyingAssertionBlob, String inResponseTo, String issuer, String samlResponse, MatchingServiceIdaStatus status) {
final PassthroughAssertion assertion = new PassthroughAssertion(new PersistentId("persistentId"),
authnContext,
underlyingAssertionBlob,
fraudDetectedDetails,
Optional.of("principalIpAddressAsSeenByIdp"));
final InboundResponseFromMatchingService inboundResponseFromMatchingService = InboundResponseFromMatchingServiceBuilder
.anInboundResponseFromMatchingService()
.withInResponseTo(inResponseTo)
.withIssuerId(issuer)
.withMatchingServiceAssertion(assertion)
.withStatus(status)
.build();
Response response = mock(Response.class);
Issuer responseIssuer = mock(Issuer.class);
when(response.getIssuer()).thenReturn(responseIssuer);
when(responseUnmarshaller.apply(samlResponse)).thenReturn(response);
when(responseToInboundResponseFromMatchingServiceTransformer.transform(response)).thenReturn(inboundResponseFromMatchingService);
}
示例3: build
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public AuthnRequest build(LevelOfAssurance levelOfAssurance, String serviceEntityId) {
AuthnRequest authnRequest = new AuthnRequestBuilder().buildObject();
authnRequest.setID(String.format("_%s", UUID.randomUUID()));
authnRequest.setIssueInstant(DateTime.now());
authnRequest.setForceAuthn(false);
authnRequest.setDestination(destination.toString());
authnRequest.setExtensions(createExtensions());
Issuer issuer = new IssuerBuilder().buildObject();
issuer.setValue(serviceEntityId);
authnRequest.setIssuer(issuer);
authnRequest.setSignature(createSignature());
try {
XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(authnRequest).marshall(authnRequest);
Signer.signObject(authnRequest.getSignature());
} catch (SignatureException | MarshallingException e) {
throw new SAMLRuntimeException("Unknown problem while signing SAML object", e);
}
return authnRequest;
}
示例4: givenAValidAttributeQuery
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的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
示例5: setUp
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() {
SoapMessageManager soapMessageManager = mock(SoapMessageManager.class);
ElementToOpenSamlXMLObjectTransformer transformer = mock(ElementToOpenSamlXMLObjectTransformer.class);
Element attributeQueryElement = mock(Element.class);
when(soapMessageManager.unwrapSoapMessage(attributeQueryDocument, SamlElementType.AttributeQuery)).thenReturn(attributeQueryElement);
Issuer issuer = mock(Issuer.class);
when(issuer.getValue()).thenReturn("theIssuerValue");
when(attributeQuery.getID()).thenReturn("theAttributeQueryId");
when(attributeQuery.getIssuer()).thenReturn(issuer);
when(transformer.apply(attributeQueryElement)).thenReturn(attributeQuery);
service = new DelegatingMatchingService(serviceLocator, soapMessageManager, transformer, assertionDecrypter);
}
示例6: formatAuthnRequest
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public String formatAuthnRequest(AuthnRequest authnRequest, Direction direction, Boolean validSignature) {
Issuer issuer = authnRequest.getIssuer();
String issuerId = issuer != null ? issuer.getValue() : "";
return String.format(AUTHN_REQUEST,
authnRequest.getID(),
direction,
authnRequest.getDestination(),
issuerId,
validSignature);
}
示例7: getIssuer
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected final Issuer getIssuer(final String spEntityId) {
final SAMLObjectBuilder<Issuer> issuerBuilder = (SAMLObjectBuilder<Issuer>) this.builderFactory
.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
final Issuer issuer = issuerBuilder.buildObject();
issuer.setValue(spEntityId);
return issuer;
}
示例8: validateIssuer
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
/**
* Validate issuer format and value.
*
* @param issuer the issuer
* @param context the context
*/
protected final void validateIssuer(final Issuer issuer, final SAML2MessageContext context) {
if (issuer.getFormat() != null && !issuer.getFormat().equals(NameIDType.ENTITY)) {
throw new SAMLException("Issuer type is not entity but " + issuer.getFormat());
}
final String entityId = context.getSAMLPeerEntityContext().getEntityId();
if (entityId == null || !entityId.equals(issuer.getValue())) {
throw new SAMLException("Issuer " + issuer.getValue() + " does not match idp entityId " + entityId);
}
}
示例9: createResponse
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public Element createResponse(String requestId, String issuerId, String message) throws MarshallingException, SignatureException {
org.opensaml.saml.saml2.core.Response response = factory.createResponse();
Issuer issuer = factory.createIssuer(issuerId);
response.setIssuer(issuer);
response.setInResponseTo(requestId);
response.setID(idGenerator.getId());
StatusCode statusCode = factory.createStatusCode();
statusCode.setValue(StatusCode.REQUESTER);
Status status = factory.createStatus();
status.setStatusCode(statusCode);
response.setStatus(status);
StatusMessage statusMessage = factory.createStatusMessage();
statusMessage.setMessage(message);
status.setStatusMessage(statusMessage);
Signature signature = factory.createSignature();
signature.setSigningCredential(credentialFactory.getSigningCredential());
response.setSignature(signature);
XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(response).marshall(response);
Signer.signObject(response.getSignature());
return response.getDOM();
}
示例10: validateIssuer
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
private void validateIssuer(Issuer issuer) {
String issuerId = issuer.getValue();
if (Strings.isNullOrEmpty(issuerId)) {
SamlValidationSpecificationFailure failure = SamlTransformationErrorFactory.missingIssuer();
throw new SamlTransformationErrorException(failure.getErrorMessage(), failure.getLogLevel());
}
}
示例11: test
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
@Override
public boolean test(MatchingServiceRequestContext matchingServiceRequestContext) {
return matchingServiceRequestContext.getAssertions().stream()
.map(Assertion::getIssuer)
.filter(Objects::nonNull)
.map(Issuer::getValue)
.filter(Objects::nonNull)
.anyMatch(countryMetadataRepository::hasMetadataForEntity);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:10,代码来源:EidasAttributesBasedAttributeQueryDiscriminator.java
示例12: apply
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public Assertion apply(MatchingServiceAssertion originalAssertion) {
Assertion transformedAssertion = openSamlXmlObjectFactory.createAssertion();
transformedAssertion.setIssueInstant(originalAssertion.getIssueInstant());
Issuer transformedIssuer = openSamlXmlObjectFactory.createIssuer(originalAssertion.getIssuerId());
transformedAssertion.setIssuer(transformedIssuer);
transformedAssertion.setID(originalAssertion.getId());
Subject subject = outboundAssertionToSubjectTransformer.transform(originalAssertion);
transformedAssertion.setSubject(subject);
MatchingServiceAuthnStatement authnStatement = originalAssertion.getAuthnStatement();
transformedAssertion.getAuthnStatements().add(matchingServiceAuthnStatementToAuthnStatementTransformer.transform(authnStatement));
Conditions conditions = openSamlXmlObjectFactory.createConditions();
AudienceRestriction audienceRestriction = openSamlXmlObjectFactory.createAudienceRestriction(originalAssertion.getAudience());
conditions.getAudienceRestrictions().add(audienceRestriction);
transformedAssertion.setConditions(conditions);
List<Attribute> userAttributesForAccountCreation = originalAssertion.getUserAttributesForAccountCreation();
if (!userAttributesForAccountCreation.isEmpty()) {
addAttributes(transformedAssertion, userAttributesForAccountCreation);
}
return transformedAssertion;
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:30,代码来源:MatchingServiceAssertionToAssertionTransformer.java
示例13: IssuerValidator
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
public IssuerValidator(Function<T, Issuer> valueProvider) {
this(
DEFAULT_REQUIRED_MESSAGE,
DEFAULT_EMPTY_VALUE_MESSAGE,
valueProvider
);
}
示例14: givenASetOfValidatedIdpAssertions
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
private ValidatedAssertions givenASetOfValidatedIdpAssertions() {
Assertion matchingDatasetAssertion = openSamlXmlObjectFactory.createAssertion();
Assertion authnStatementAssertion = openSamlXmlObjectFactory.createAssertion();
Issuer mdsIssuer = openSamlXmlObjectFactory.createIssuer(IDP_ENTITY_ID);
Issuer authnStatementIssuer = openSamlXmlObjectFactory.createIssuer(IDP_ENTITY_ID);
matchingDatasetAssertion.setIssuer(mdsIssuer);
authnStatementAssertion.setIssuer(authnStatementIssuer);
return new ValidatedAssertions(ImmutableList.of(matchingDatasetAssertion, authnStatementAssertion));
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:10,代码来源:InboundMatchingServiceRequestUnmarshallerTest.java
示例15: shouldReturnErrorIfAnIssuerIsEmpty
import org.opensaml.saml.saml2.core.Issuer; //导入依赖的package包/类
@Test
public void shouldReturnErrorIfAnIssuerIsEmpty() {
Issuer issuer = anIssuer().withIssuerId("").build();
Messages messages = validator.validate(issuer, messages());
assertThat(messages.hasErrorLike(DEFAULT_EMPTY_VALUE_MESSAGE)).isTrue();
}