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


Java Response.setIssuer方法代码示例

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


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

示例1: buildResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
public Response buildResponse(SAMLSSOAuthnReqDTO authReqDTO, Assertion assertion)
        throws IdentityException {

    if (log.isDebugEnabled()) {
        log.debug("Building SAML Response for the consumer '"
                + authReqDTO.getAssertionConsumerURL() + "'");
    }
    Response response = new org.opensaml.saml2.core.impl.ResponseBuilder().buildObject();
    response.setIssuer(SAMLSSOUtil.getIssuer());
    response.setID(SAMLSSOUtil.createID());
    response.setInResponseTo(authReqDTO.getId());
    response.setDestination(authReqDTO.getAssertionConsumerURL());
    response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
    response.setVersion(SAMLVersion.VERSION_20);
    DateTime issueInstant = new DateTime();
    response.setIssueInstant(issueInstant);
    response.getAssertions().add(assertion);
    if (authReqDTO.isDoSignResponse()) {
        SAMLSSOUtil.setSignature(response, authReqDTO.getSigningAlgorithmUri(), authReqDTO.getDigestAlgorithmUri
                (), new SignKeyDataHolder(authReqDTO.getUser().getAuthenticatedSubjectIdentifier()));
    }
    return response;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:24,代码来源:DefaultResponseBuilder.java

示例2: generateErrorneousResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
public static String generateErrorneousResponse() {
    Response response = new ResponseBuilder().buildObject();
    response.setIssuer(getIssuer());
    response.setStatus(buildStatus());
    response.setVersion(SAMLVersion.VERSION_20);
    response.setID(UIDGenerator.generateUID());

    try {
        return encode(marshall(response));
    } catch (IdentityException e) {
        if (log.isDebugEnabled()) {
            log.debug("Error while encoding.", e);
        }
        return null;
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:17,代码来源:ErrorResponseBuilder.java

示例3: testQuery

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
@Test
public void testQuery() throws Exception{
	final SOAPClient client = context.mock(SOAPClient.class);
	final String location = idpMetadata.getFirstMetadata().getAttributeQueryServiceLocation(SAMLConstants.SAML2_SOAP11_BINDING_URI);
	
	Assertion ass = TestHelper.buildAssertion(null, spMetadata.getEntityID());
	ass.getAttributeStatements().get(0).getAttributes().clear();
	AttributeStatement stmt = SAMLUtil.buildXMLObject(AttributeStatement.class);
	stmt.getAttributes().add(AttributeUtil.createAttribute("attr1", null, null));
	stmt.getAttributes().add(AttributeUtil.createAttribute("attr2", null, null));
	ass.getAttributeStatements().add(stmt);
	
	final Response resp = SAMLUtil.buildXMLObject(Response.class);
	resp.getAssertions().add(ass);
	resp.setIssuer(SAMLUtil.createIssuer(idpEntityId));
	resp.setStatus(SAMLUtil.createStatus(StatusCode.SUCCESS_URI));
	new OIOResponse(resp).sign(credential);
	
	context.checking(new Expectations() {{
		one(client).wsCall(with(any(OIOAttributeQuery.class)), with(equal(location)), with(aNull(String.class)), with(aNull(String.class)), with(equal(true)));
		will(returnValue(resp));
	}});
	
	UserAttributeQuery q = new UserAttributeQuery(idpMetadata.getFirstMetadata(), null, null, client, credential, true, false, spMetadata.getEntityID());
	Collection<UserAttribute> attrs = q.query("name", NameIDFormat.EMAIL,"attr1", "attr2");
	assertEquals(2, attrs.size());
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:28,代码来源:UserAttributeQueryTest.java

示例4: buildResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
/**
   * Build the SAML Response Object
   *
   * @param pRequestContext
   * @param pTimeoutMS
   * @param pRecipient
   * @param pAudienceURI
   * @param pAssertionAttributes
   * @param pSignResponse
   * @param pSignAssertion
   * @param pDigitalCertificateName
   * @return SAML Response Object
   */
  private Response buildResponse(ActionRequestContext pRequestContext
    , Integer pTimeoutMS
    , String pRecipient
    , String pAudienceURI
    , Map<String, String> pAssertionAttributes
    , boolean pSignResponse
    , boolean pSignAssertion
    , String pDigitalCertificateName
  ) {
    Response lResponse = new org.opensaml.saml2.core.impl.ResponseBuilder().buildObject();
    lResponse.setIssuer(buildIssuer(pRequestContext.getFoxRequest().getHttpRequest().getRequestURL().toString()));
    lResponse.setID(RESPONSE_ID_PREFIX + RandomString.getString(40));
//    lResponse.setInResponseTo(authReqDTO.getId());
//    lResponse.setDestination(authReqDTO.getAssertionConsumerURL());
    lResponse.setStatus(buildStatus(StatusCode.SUCCESS_URI));
    lResponse.setVersion(SAMLVersion.VERSION_20);

    DateTime issueInstant = new DateTime();
    lResponse.setIssueInstant(issueInstant);


    DateTime lNotOnOrAfter = new DateTime(issueInstant.getMillis() + pTimeoutMS);
    Assertion assertion = buildSAMLAssertion(pRequestContext, lNotOnOrAfter, pRecipient, pAudienceURI, pAssertionAttributes, pSignAssertion, pDigitalCertificateName);
    lResponse.getAssertions().add(assertion);

    // Sign the SAML Response object
    if (pSignResponse) {
      signSAMLObject(lResponse, pRequestContext, pDigitalCertificateName);
    }

    return lResponse;
  }
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:46,代码来源:SAMLResponseCommand.java

示例5: buildSAMLResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
/**
 * Build SAML response using IdP configuration & user name
 *
 * @param ssoIdPConfigs
 * @param userName
 * @return SAML Response object
 * @throws IdentityException
 */
public Response buildSAMLResponse(SAMLSSOServiceProviderDO ssoIdPConfigs, String userName)
        throws IdentityException {
    if (log.isDebugEnabled()) {
        log.debug("Building SAML Response for the consumer '" +
                ssoIdPConfigs.getAssertionConsumerUrl() + "'");
    }
    Response response = new org.opensaml.saml2.core.impl.ResponseBuilder().buildObject();
    response.setIssuer(SAMLSSOUtil.getIssuer());
    response.setID(SAMLSSOUtil.createID());
    response.setDestination(ssoIdPConfigs.getAssertionConsumerUrl());
    response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
    response.setVersion(SAMLVersion.VERSION_20);
    DateTime issueInstant = new DateTime();
    DateTime notOnOrAfter =
            new DateTime(issueInstant.getMillis() +
                    SAMLSSOUtil.getSAMLResponseValidityPeriod() * 60 *
                            1000);
    response.setIssueInstant(issueInstant);
    Assertion assertion = buildSAMLAssertion(ssoIdPConfigs, notOnOrAfter, userName);
    if (ssoIdPConfigs.isDoEnableEncryptedAssertion()) {
        String domainName = MultitenantUtils.getTenantDomain(userName);
        String alias = ssoIdPConfigs.getCertAlias();
        if (alias != null) {
            EncryptedAssertion encryptedAssertion =
                    SAMLSSOUtil.setEncryptedAssertion(assertion,
                            EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256,
                            alias,
                            domainName);
            response.getEncryptedAssertions().add(encryptedAssertion);
        }
    } else {
        response.getAssertions().add(assertion);
    }
    if (ssoIdPConfigs.isDoSignResponse()) {
        SAMLSSOUtil.setSignature(response, ssoIdPConfigs.getSigningAlgorithmUri(), ssoIdPConfigs
                .getDigestAlgorithmUri(), new SignKeyDataHolder(userName));
    }
    return response;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:48,代码来源:SAMLResponseBuilder.java

示例6: createResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
private Response createResponse(final DateTime issueDate, Issuer issuer, Status status, Assertion assertion) {
	ResponseBuilder responseBuilder = new ResponseBuilder();
	Response response = responseBuilder.buildObject();
	response.setID(UUID.randomUUID().toString());
	response.setIssueInstant(issueDate);
	response.setVersion(SAMLVersion.VERSION_20);
	response.setIssuer(issuer);
	response.setStatus(status);
	response.getAssertions().add(assertion);
	return response;
}
 
开发者ID:rackerlabs,项目名称:saml-generator,代码行数:12,代码来源:SamlAssertionProducer.java

示例7: buildMockResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
private Response buildMockResponse() throws Exception {
    Response samlMessage = new ResponseBuilder().buildObject();
    samlMessage.setID("foo");
    samlMessage.setVersion(SAMLVersion.VERSION_20);
    samlMessage.setIssueInstant(new DateTime(0));
    Issuer issuer = new IssuerBuilder().buildObject();
    issuer.setValue("MockedIssuer");
    samlMessage.setIssuer(issuer);
    Status status = new StatusBuilder().buildObject();
    StatusCode statusCode = new StatusCodeBuilder().buildObject();
    statusCode.setValue(StatusCode.SUCCESS_URI);
    status.setStatusCode(statusCode);
    samlMessage.setStatus(status);
    Assertion assertion = new AssertionBuilder().buildObject();
    Subject subject = new SubjectBuilder().buildObject();
    NameID nameID = new NameIDBuilder().buildObject();
    nameID.setValue("SOME-UNIQUE-ID");
    nameID.setFormat(NameIDType.PERSISTENT);
    subject.setNameID(nameID);
    assertion.setSubject(subject);
    AuthnStatement authnStatement = new AuthnStatementBuilder().buildObject();
    authnStatement.setSessionIndex("Some Session String");
    assertion.getAuthnStatements().add(authnStatement);
    AttributeStatement attributeStatement = new AttributeStatementBuilder().buildObject();
    assertion.getAttributeStatements().add(attributeStatement);
    samlMessage.getAssertions().add(assertion);
    return samlMessage;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:29,代码来源:SAML2LoginAPIAuthenticatorCmdTest.java

示例8: createResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
private static Response createResponse() throws Exception {

		Response response = create(Response.DEFAULT_ELEMENT_NAME);

		response.setID(GENERATOR.generateIdentifier());

		if (SamlResponseData.REPLACE_WITH_AUTHN_REQUEST.equals(samlResponseData
				.getInResponseTo())) {
			response.setInResponseTo(authnRequest.getID());
		} else
			response.setInResponseTo(samlResponseData.getInResponseTo());

		if (SamlResponseData.REPLACE_WITH_AUTHN_REQUEST.equals(samlResponseData
				.getDestination()))
			response.setDestination(authnRequest
					.getAssertionConsumerServiceURL());
		else
			response.setDestination(samlResponseData.getDestination());

		if (samlResponseData.getIssueInstant() != null) {
			response.setIssueInstant(startTime.plusMinutes(samlResponseData
					.getIssueInstant()));
		}

		response.setIssuer(createIssuer(samlResponseData.getIssuer()));
		response.setStatus(createStatus());
		response.getAssertions().add(createAssertion());

		return response;
	}
 
开发者ID:vetsin,项目名称:SamlSnort,代码行数:31,代码来源:SamlTool.java

示例9: buildArtifactResponse

import org.opensaml.saml2.core.Response; //导入方法依赖的package包/类
private ArtifactResponse buildArtifactResponse() throws IllegalAccessException, NoSuchAlgorithmException, KeyStoreException,
		java.security.cert.CertificateException, CertificateException, IOException, SecurityException, EncryptionException, NoSuchProviderException,
		SignatureException, MarshallingException, MetadataProviderException {
	SecureRandomIdentifierGenerator idGenerator = new SecureRandomIdentifierGenerator();

	ArtifactResponse artifactResponse = buildXMLObjectDefaultName(ArtifactResponse.class);

	Issuer issuer = buildXMLObjectDefaultName(Issuer.class);
	issuer.setValue(MockIDPProperties.getIdpEntityId());
	artifactResponse.setIssuer(issuer);
	artifactResponse.setIssueInstant(new DateTime());
	artifactResponse.setDestination(MockIDPSPMetadata.getSpConsumerUrl());

	artifactResponse.setID(idGenerator.generateIdentifier());

	Status status = buildXMLObjectDefaultName(Status.class);
	StatusCode statusCode = buildXMLObjectDefaultName(StatusCode.class);
	statusCode.setValue(StatusCode.SUCCESS_URI);
	status.setStatusCode(statusCode);
	artifactResponse.setStatus(status);

	Response response = buildXMLObjectDefaultName(Response.class);
	response.setDestination(MockIDPSPMetadata.getSpConsumerUrl());
	response.setIssueInstant(new DateTime());
	response.setID(idGenerator.generateIdentifier());
	response.setInResponseTo(MockIDPAuthnReq.authnReqId);
	Issuer issuer2 = buildXMLObjectDefaultName(Issuer.class);
	issuer2.setValue(MockIDPProperties.getIdpEntityId());

	response.setIssuer(issuer2);

	Status status2 = buildXMLObjectDefaultName(Status.class);
	StatusCode statusCode2 = buildXMLObjectDefaultName(StatusCode.class);
	statusCode2.setValue(StatusCode.SUCCESS_URI);
	status2.setStatusCode(statusCode2);

	response.setStatus(status2);

	artifactResponse.setMessage(response);

	response.getEncryptedAssertions().add(encryptAssertion(buildAssertion()));
	return artifactResponse;
}
 
开发者ID:rasmusson,项目名称:MockIDP,代码行数:44,代码来源:MockIDPArtifactResolve.java


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