本文整理汇总了Java中org.opensaml.saml2.core.Issuer类的典型用法代码示例。如果您正苦于以下问题:Java Issuer类的具体用法?Java Issuer怎么用?Java Issuer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Issuer类属于org.opensaml.saml2.core包,在下文中一共展示了Issuer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildLogoutRequest
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
protected LogoutRequest buildLogoutRequest(String user, String sessionIdx) throws SSOAgentException {
LogoutRequest logoutReq = new LogoutRequestBuilder().buildObject();
logoutReq.setID(SSOAgentUtils.createID());
logoutReq.setDestination(ssoAgentConfig.getSAML2().getIdPURL());
DateTime issueInstant = new DateTime();
logoutReq.setIssueInstant(issueInstant);
logoutReq.setNotOnOrAfter(new DateTime(issueInstant.getMillis() + 5 * 60 * 1000));
IssuerBuilder issuerBuilder = new IssuerBuilder();
Issuer issuer = issuerBuilder.buildObject();
issuer.setValue(ssoAgentConfig.getSAML2().getSPEntityId());
logoutReq.setIssuer(issuer);
NameID nameId = new NameIDBuilder().buildObject();
nameId.setFormat("urn:oasis:names:tc:SAML:2.0:nameid-format:entity");
nameId.setValue(user);
logoutReq.setNameID(nameId);
SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
sessionIndex.setSessionIndex(sessionIdx);
logoutReq.getSessionIndexes().add(sessionIndex);
logoutReq.setReason("Single Logout");
return logoutReq;
}
示例2: testFindSaml20IdpConnectorToUseToProcessRequests
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/**
* The SP receive à LogoutRequest from the IdP. Which IdPConnector to choose ?
*
* @throws Exception
*/
@Test
public void testFindSaml20IdpConnectorToUseToProcessRequests() throws Exception {
final LogoutRequest logoutRequest = this.logoutRequestBuilder.buildObject();
final Issuer issuer = issuerBuilder.buildObject();
// Issuer
issuer.setValue(IDP2_ENTITY_ID);
// Request
logoutRequest.setIssuer(issuer);
logoutRequest.setID(REQUEST_ID);
final ISaml20IdpConnector connectorToUse = this.spProcessor.findSaml20IdpConnectorToUse(logoutRequest);
Assert.assertNotNull("No IdPConnector to use found !", connectorToUse);
Assert.assertEquals("Wrong IdPConnector used !", this.idpConnector2, connectorToUse);
}
示例3: processChildElement
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
Assertion assertion = (Assertion) parentObject;
if (childObject instanceof Issuer) {
assertion.setIssuer((Issuer) childObject);
} else if (childObject instanceof Signature) {
assertion.setSignature((Signature) childObject);
} else if (childObject instanceof Subject) {
assertion.setSubject((Subject) childObject);
} else if (childObject instanceof Conditions) {
assertion.setConditions((Conditions) childObject);
} else if (childObject instanceof Advice) {
assertion.setAdvice((Advice) childObject);
} else if (childObject instanceof Statement) {
assertion.getStatements().add((Statement) childObject);
} else {
super.processChildElement(parentObject, childObject);
}
}
示例4: processChildElement
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
ArtifactResponse artifactResponse = (ArtifactResponse) parentSAMLObject;
if (childSAMLObject instanceof Issuer) {
artifactResponse.setIssuer((Issuer) childSAMLObject);
} else if (childSAMLObject instanceof Signature) {
artifactResponse.setSignature((Signature) childSAMLObject);
} else if (childSAMLObject instanceof Extensions) {
artifactResponse.setExtensions((Extensions) childSAMLObject);
} else if (childSAMLObject instanceof Status) {
artifactResponse.setStatus((Status) childSAMLObject);
} else {
artifactResponse.setMessage((SAMLObject) childSAMLObject);
}
}
示例5: processChildElement
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
StatusResponseType sr = (StatusResponseType) parentSAMLObject;
if (childSAMLObject instanceof Issuer) {
sr.setIssuer((Issuer) childSAMLObject);
} else if (childSAMLObject instanceof Signature) {
sr.setSignature((Signature) childSAMLObject);
} else if (childSAMLObject instanceof Extensions) {
sr.setExtensions((Extensions) childSAMLObject);
} else if (childSAMLObject instanceof Status) {
sr.setStatus((Status) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例6: buildLogoutResponse
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
public LogoutResponse buildLogoutResponse(String id, String status, String statMsg)
throws SSOAgentException {
LogoutResponse logoutResp = new LogoutResponseBuilder().buildObject();
logoutResp.setID(SSOAgentUtils.createID());
logoutResp.setInResponseTo(id);
IssuerBuilder issuerBuilder = new IssuerBuilder();
Issuer issuer = issuerBuilder.buildObject();
issuer.setValue(ssoAgentConfig.getSAML2().getSPEntityId());
logoutResp.setIssuer(issuer);
logoutResp.setStatus(buildStatus(status, statMsg));
logoutResp.setIssueInstant(new DateTime());
logoutResp.setDestination(ssoAgentConfig.getSAML2().getIdPURL());
SSOAgentUtils.setSignatureValue(logoutResp, XMLSignature.ALGO_ID_SIGNATURE_RSA,
new X509CredentialImpl(ssoAgentConfig.getSAML2().getSSOAgentX509Credential()));
return logoutResp;
}
示例7: getOriginatingIdpEntityId
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/**
* Get the id of the issuing entity.
* @param handler Handler which holds sent request ids. This is used if the response has a InResponseTo.
*
* @throws ValidationException If the response is unsolicited and does not contain an issuer.
*/
public String getOriginatingIdpEntityId(SessionHandler handler) {
if (response.getInResponseTo() == null) {
Issuer issuer = null;
if (!response.getAssertions().isEmpty()) {
issuer = response.getAssertions().get(0).getIssuer();
}
if (issuer == null) {
issuer = response.getIssuer();
}
if (issuer == null) {
throw new ValidationException("SAML Response does not contain a issuer, this is required for unsolicited Responses");
}
return issuer.getValue();
} else {
return handler.removeEntityIdForRequest(response.getInResponseTo());
}
}
示例8: setAssertion
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
public synchronized void setAssertion(String sessionId, OIOAssertion assertion) throws IllegalArgumentException{
Issuer issuer = assertion.getAssertion().getIssuer();
String key = (issuer != null ? issuer.getValue() : "unknown") + ":" + assertion.getAssertion().getID();
if(usedAssertionIds.containsKey(key)) {
throw new IllegalArgumentException("Assertion ID begin replayed: " + key);
}
usedAssertionIds.put(key, assertion.getAssertion().getID());
sessionMap.put(sessionId, new TimeOutWrapper<OIOAssertion>(assertion));
String sessionIndex = assertion.getSessionIndex();
if (sessionIndex != null) {
// Remove the old sessionIndex
sessionIndexMap.remove(sessionIndex);
// Store the new sessionIndex
sessionIndexMap.put(sessionIndex, new TimeOutWrapper<String>(sessionId));
}
}
示例9: buildRequest
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
public AuthnRequest buildRequest(String spProviderId, String acsUrl, String idpUrl){
/* Building Issuer object */
IssuerBuilder issuerBuilder = new IssuerBuilder();
Issuer issuer =
issuerBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:assertion",
"Issuer", "saml2p");
issuer.setValue(spProviderId);
/* Creation of AuthRequestObject */
DateTime issueInstant = new DateTime();
AuthnRequestBuilder authRequestBuilder = new AuthnRequestBuilder();
AuthnRequest authRequest =
authRequestBuilder.buildObject(SAMLConstants.SAML20P_NS,
"AuthnRequest", "saml2p");
authRequest.setForceAuthn(false);
authRequest.setIssueInstant(issueInstant);
authRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);
authRequest.setAssertionConsumerServiceURL(acsUrl);
authRequest.setIssuer(issuer);
authRequest.setVersion(SAMLVersion.VERSION_20);
authRequest.setDestination(idpUrl);
return authRequest;
}
示例10: buildLogoutRequest
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/**
* Build the logout request
*
* @param subject name of the user
* @param reason reason for generating logout request.
* @return LogoutRequest object
* @throws Exception
*/
public LogoutRequest buildLogoutRequest(String subject, String reason, String sessionIndexStr) throws Exception {
log.info("Building logout request");
Util.doBootstrap();
LogoutRequest logoutReq = new org.opensaml.saml2.core.impl.LogoutRequestBuilder().buildObject();
logoutReq.setID(Util.createID());
logoutReq.setDestination(Util.getIdentityProviderSSOServiceURL());
DateTime issueInstant = new DateTime();
logoutReq.setIssueInstant(issueInstant);
logoutReq.setNotOnOrAfter(new DateTime(issueInstant.getMillis() + 5 * 60 * 1000));
IssuerBuilder issuerBuilder = new IssuerBuilder();
Issuer issuer = issuerBuilder.buildObject();
issuer.setValue(Util.getServiceProviderId());
logoutReq.setIssuer(issuer);
NameID nameId = new NameIDBuilder().buildObject();
nameId.setFormat(SAML2SSOAuthenticatorConstants.SAML2_NAME_ID_POLICY_TRANSIENT);
nameId.setValue(subject);
logoutReq.setNameID(nameId);
SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
sessionIndex.setSessionIndex(sessionIndexStr);
logoutReq.getSessionIndexes().add(sessionIndex);
logoutReq.setReason(reason);
Util.setSignature(logoutReq, XMLSignature.ALGO_ID_SIGNATURE_RSA, new SignKeyDataHolder());
return logoutReq;
}
示例11: setUp
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/** {@inheritDoc} */
protected void setUp() throws Exception {
super.setUp();
expectedID = "def456";
expectedInResponseTo = "abc123";
expectedSAMLVersion = SAMLVersion.VERSION_20;
expectedIssueInstant = new DateTime(2006, 2, 21, 16, 40, 0, 0, ISOChronology.getInstanceUTC());
expectedDestination = "http://sp.example.org/endpoint";
expectedConsent = "urn:string:consent";
QName issuerQName = new QName(SAMLConstants.SAML20_NS, Issuer.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
expectedIssuer = (Issuer) buildXMLObject(issuerQName);
QName statusQName = new QName(SAMLConstants.SAML20P_NS, Status.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
expectedStatus = (Status) buildXMLObject(statusQName);
}
示例12: getSAMLBuilder
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
private static XMLObjectBuilderFactory getSAMLBuilder() throws ConfigurationException {
if (builderFactory == null) {
// OpenSAML 2.3
DefaultBootstrap.bootstrap();
builderFactory = Configuration.getBuilderFactory();
nameIdBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(NameID.DEFAULT_ELEMENT_NAME);
confirmationMethodBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
subjectConfirmationBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
subjectBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Subject.DEFAULT_ELEMENT_NAME);
attrStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
audienceRestrictionnBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AudienceRestriction.DEFAULT_ELEMENT_NAME);
audienceBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Audience.DEFAULT_ELEMENT_NAME);
authStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME);
authContextBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContext.DEFAULT_ELEMENT_NAME);
authContextClassRefBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
issuerBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
assertionBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
}
return builderFactory;
}
示例13: createAssertion
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
private Assertion createAssertion(final DateTime issueDate, Subject subject, Issuer issuer, AuthnStatement authnStatement,
AttributeStatement attributeStatement) {
AssertionBuilder assertionBuilder = new AssertionBuilder();
Assertion assertion = assertionBuilder.buildObject();
assertion.setID(UUID.randomUUID().toString());
assertion.setIssueInstant(issueDate);
assertion.setSubject(subject);
assertion.setIssuer(issuer);
if (authnStatement != null)
assertion.getAuthnStatements().add(authnStatement);
if (attributeStatement != null)
assertion.getAttributeStatements().add(attributeStatement);
return assertion;
}
示例14: testFindSaml20IdpConnectorToUseToProcessResponses
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/**
* The SP receive à LogoutResponse from the IdP. Which IdPConnector to choose ?
* @throws Exception
*/
@Test
public void testFindSaml20IdpConnectorToUseToProcessResponses() throws Exception {
// Mock the Original Request the response is responding to.
Mockito.when(this.samlStorage.findAuthentication(SESSION_INDEX_1)).thenReturn(this.buildBasicSamlAuthentication());
// Build the original request with IdpConnector1
final IOutgoingSaml logoutRequest = this.idpConnector1.buildSaml20SingleLogoutRequest(SESSION_INDEX_1, SamlBindingEnum.SAML_20_HTTP_POST);
Mockito.when(this.samlStorage.findRequestWaitingForResponse(REQUEST_ID)).thenReturn((IRequestWaitingForResponse) logoutRequest.getSamlQuery());
final LogoutResponse logoutResponse = this.logoutResponseBuilder.buildObject();
final Issuer issuer = issuerBuilder.buildObject();
// Issuer
issuer.setValue(IDP1_ENTITY_ID);
// Request
logoutResponse.setIssuer(issuer);
logoutResponse.setID(RESPONSE_ID);
logoutResponse.setInResponseTo(REQUEST_ID);
final ISaml20IdpConnector connectorToUse = this.spProcessor.findSaml20IdpConnectorToUse(logoutResponse);
Assert.assertNotNull("No IdPConnector to use found !", connectorToUse);
Assert.assertEquals("Wrong IdPConnector used !", this.idpConnector1, connectorToUse);
}
示例15: processChildElement
import org.opensaml.saml2.core.Issuer; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
Request request = (Request) parentSAMLObject;
if (childSAMLObject instanceof Issuer) {
request.setIssuer((Issuer) childSAMLObject);
} else if (childSAMLObject instanceof IDPList) {
request.setIDPList((IDPList) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}