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


Java ArtifactResponse类代码示例

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


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

示例1: processChildElement

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的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);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ArtifactResponseUnmarshaller.java

示例2: testPost

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Test
public void testPost() throws Exception {
	String id = Utils.generateUUID();
	handler.registerRequest(id, idpEntityId);
	ArtifactResponse r = (ArtifactResponse) buildResponse(Utils.generateUUID(), true, false, id).getBody().getUnknownXMLObjects().get(0);
	final String response = Base64.encodeBytes(XMLHelper.nodeToString(SAMLUtil.marshallObject(r.getMessage())).getBytes());
	
	context.checking(new Expectations() {{
		allowing(req).getCookies(); will(returnValue(null));
		allowing(req).getParameter(Constants.SAML_SAMLRESPONSE); will(returnValue(response));
		one(req).getParameter(Constants.SAML_RELAYSTATE); will(returnValue(handler.saveRequest(new Request("requesturi", "query", "GET", new HashMap<String, String[]>()))));
		one(session).setAttribute(with(equal(Constants.SESSION_USER_ASSERTION)), with(any(UserAssertion.class)));
		one(res).sendRedirect("requesturi?query");
		one(session).getMaxInactiveInterval(); will(returnValue(30));
	}});
	
	expectCacheHeaders();
	
	sh.handlePost(ctx);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:21,代码来源:SAMLAssertionConsumerHandlerTest.java

示例3: testRedirectWithUrlFragmentIfSavedInCookie

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Test
public void testRedirectWithUrlFragmentIfSavedInCookie() throws Exception {
	String id = Utils.generateUUID();
	handler.registerRequest(id, idpEntityId);
	ArtifactResponse r = (ArtifactResponse) buildResponse(Utils.generateUUID(), true, false, id).getBody().getUnknownXMLObjects().get(0);
	final String response = Base64.encodeBytes(XMLHelper.nodeToString(SAMLUtil.marshallObject(r.getMessage())).getBytes());
	
	final Cookie fragment = new Cookie("oiosaml-fragment", URLEncoder.encode("#test=more", "utf-8"));
	context.checking(new Expectations() {{
		allowing(req).getCookies(); will(returnValue(new Cookie[] { fragment }));
		one(res).addCookie(with(any(Cookie.class)));
		allowing(req).getParameter(Constants.SAML_SAMLRESPONSE); will(returnValue(response));
		one(req).getParameter(Constants.SAML_RELAYSTATE); will(returnValue(handler.saveRequest(new Request("requesturi", "query", "GET", new HashMap<String, String[]>()))));
		one(session).setAttribute(with(equal(Constants.SESSION_USER_ASSERTION)), with(any(UserAssertion.class)));
		one(res).sendRedirect("requesturi?query#test=more");
		one(session).getMaxInactiveInterval(); will(returnValue(30));
	}});
	
	expectCacheHeaders();
	
	sh.handlePost(ctx);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:23,代码来源:SAMLAssertionConsumerHandlerTest.java

示例4: authenticationHookMustBeInvokedIfConfigured

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Test
public void authenticationHookMustBeInvokedIfConfigured() throws Exception {
	AuthenticationHandlerStub.invoked = false;
	conf.put(Constants.PROP_AUTHENTICATION_HANDLER, AuthenticationHandlerStub.class.getName());
	
	String id = Utils.generateUUID();
	handler.registerRequest(id, idpEntityId);
	ArtifactResponse r = (ArtifactResponse) buildResponse(Utils.generateUUID(), true, false, id).getBody().getUnknownXMLObjects().get(0);
	final String response = Base64.encodeBytes(XMLHelper.nodeToString(SAMLUtil.marshallObject(r.getMessage())).getBytes());
	
	context.checking(new Expectations() {{
		allowing(req).getCookies(); will(returnValue(null));
		allowing(req).getParameter(Constants.SAML_SAMLRESPONSE); will(returnValue(response));
		one(req).getParameter(Constants.SAML_RELAYSTATE); will(returnValue(handler.saveRequest(new Request("requesturi", "query", "GET", new HashMap<String, String[]>()))));
		one(session).setAttribute(with(equal(Constants.SESSION_USER_ASSERTION)), with(any(UserAssertion.class)));
		one(res).sendRedirect("requesturi?query");
		one(session).getMaxInactiveInterval(); will(returnValue(30));
	}});
	
	expectCacheHeaders();
	AuthenticationHandlerStub.succeed = true;
	sh.handlePost(ctx);
	assertTrue(AuthenticationHandlerStub.invoked);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:25,代码来源:SAMLAssertionConsumerHandlerTest.java

示例5: authenticationHookFailureMustAbort

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Test
public void authenticationHookFailureMustAbort() throws Exception {
	AuthenticationHandlerStub.invoked = false;
	conf.put(Constants.PROP_AUTHENTICATION_HANDLER, AuthenticationHandlerStub.class.getName());
	
	String id = Utils.generateUUID();
	handler.registerRequest(id, idpEntityId);
	ArtifactResponse r = (ArtifactResponse) buildResponse(Utils.generateUUID(), true, false, id).getBody().getUnknownXMLObjects().get(0);
	final String response = Base64.encodeBytes(XMLHelper.nodeToString(SAMLUtil.marshallObject(r.getMessage())).getBytes());
	
	context.checking(new Expectations() {{
		allowing(req).getParameter(Constants.SAML_SAMLRESPONSE); will(returnValue(response));
		one(req).getParameter(Constants.SAML_RELAYSTATE); will(returnValue(handler.saveRequest(new Request("requesturi", "query", "GET", new HashMap<String, String[]>()))));
	}});
	
	AuthenticationHandlerStub.succeed = false;
	sh.handlePost(ctx);
	assertTrue(AuthenticationHandlerStub.invoked);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:20,代码来源:SAMLAssertionConsumerHandlerTest.java

示例6: processArtifactBinding

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/**
 * Handles artifact binding request.
 * @param request
 * @param uriInfo
 * @return
 */
@GET
@Path("sso/artifact")
public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) {
    String artifact = request.getParameter("SAMLart");
    String realmId = request.getParameter("RelayState");

    if (artifact == null) {
        throw new APIAccessDeniedException("No artifact provided by the IdP");
    }

    String artifactUrl = samlHelper.getArtifactUrl(realmId, artifact);


    ArtifactResolve artifactResolve = artifactBindingHelper.generateArtifactResolveRequest(artifact, dsPKEntry, artifactUrl);
    Envelope soapEnvelope = artifactBindingHelper.generateSOAPEnvelope(artifactResolve);

    XMLObject response = soapHelper.sendSOAPCommunication(soapEnvelope, artifactUrl, clientCertPKEntry);

    ArtifactResponse artifactResponse = (ArtifactResponse)((EnvelopeImpl) response).getBody().getUnknownXMLObjects().get(0);
    org.opensaml.saml2.core.Response samlResponse = (org.opensaml.saml2.core.Response) artifactResponse.getMessage();

    return processSAMLResponse(samlResponse, uriInfo);
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:30,代码来源:SamlFederationResource.java

示例7: setUp

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	srt = (Response) ((ArtifactResponse)SAMLUtil.unmarshallElement(getClass().getResourceAsStream("response.xml"))).getMessage();
	srt.setDestination(destination);
	srt.getIssuer().setValue(issuerValue);
	
	response = new OIOResponse(srt);

	credential = TestHelper.getCredential();
	cert = TestHelper.getCertificate(credential);
	
	response.sign(credential);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:14,代码来源:OIOResponseTest.java

示例8: testArtifactResolve

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@Test
public void testArtifactResolve() throws Exception {
	ArtifactResolve ar = SAMLUtil.buildXMLObject(ArtifactResolve.class);
	
	Envelope env = client.wsCall(ar, "http://localhost:12349", "test", "test", true);
	assertTrue(env.getBody().getUnknownXMLObjects().get(0) instanceof ArtifactResponse);
	assertEquals("\"http://www.oasis-open.org/committees/security\"", ds.headers.get("SOAPAction"));
	
	assertEquals("test:test", new String(Base64.decode(ds.headers.get("Authorization").split(" ")[1]), "UTF-8"));
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:11,代码来源:HttpSOAPClientTest.java

示例9: run

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
public void run() {
	try {
		
		Socket client = ss.accept();
		BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
		
		StringBuilder sb = new StringBuilder();
		String line = null;
		
		headers = new HashMap<String, String>();
		while ((line = in.readLine()) != null) {
			if ("".equals(line.trim())) {
				for (int i = 0; i < Integer.parseInt(headers.get("Content-Length")); i++) {
					sb.append((char)in.read());
				}
				break;
			}
			String[] h = line.split(": ");
			if (h.length == 2) {
				headers.put(h[0], h[1]);
			}
		}
		PrintWriter pw = new PrintWriter(client.getOutputStream());
		pw.println("HTTP/1.1 200 OK");
		pw.println("Server: test");
		pw.println();

		Envelope env = SAMLUtil.buildXMLObject(Envelope.class);
		Body body = SAMLUtil.buildXMLObject(Body.class);
		env.setBody(body);
		body.getUnknownXMLObjects().add(SAMLUtil.buildXMLObject(ArtifactResponse.class));
		pw.println(XMLHelper.nodeToString(SAMLUtil.marshallObject(env)));
		pw.close();
		
	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:40,代码来源:HttpSOAPClientTest.java

示例10: testSingleElementMarshall

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    ArtifactResponse ar = (ArtifactResponse) buildXMLObject(qname);
    
    super.populateRequiredAttributes(ar);

    assertEquals(expectedDOM, ar);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:ArtifactResponseTest.java

示例11: testSingleElementOptionalAttributesMarshall

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    ArtifactResponse ar = (ArtifactResponse) buildXMLObject(qname);
    
    super.populateRequiredAttributes(ar);
    super.populateOptionalAttributes(ar);
    
    assertEquals(expectedOptionalAttributesDOM, ar);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:ArtifactResponseTest.java

示例12: testChildElementsMarshall

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    ArtifactResponse ar = (ArtifactResponse) buildXMLObject(qname);
    
    super.populateChildElements(ar);
    
    assertEquals(expectedChildElementsDOM, ar);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:ArtifactResponseTest.java

示例13: validate

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(ArtifactResponse response) throws ValidationException {
    super.validate(response);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ArtifactResponseSchemaValidator.java

示例14: buildObject

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public ArtifactResponse buildObject() {
    return buildObject(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:ArtifactResponseBuilder.java

示例15: ArtifactResponseMarshaller

import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** Constructor. */
public ArtifactResponseMarshaller() {
    super(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:5,代码来源:ArtifactResponseMarshaller.java


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