本文整理汇总了Java中org.opensaml.saml2.core.ArtifactResponse类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactResponse类的具体用法?Java ArtifactResponse怎么用?Java ArtifactResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactResponse类属于org.opensaml.saml2.core包,在下文中一共展示了ArtifactResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ArtifactResponseUnmarshaller
import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** Constructor. */
public ArtifactResponseUnmarshaller() {
super(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:5,代码来源:ArtifactResponseUnmarshaller.java
示例17: ArtifactResponseSchemaTest
import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/**
* Constructor
*
*/
public ArtifactResponseSchemaTest() {
super();
targetQName = new QName(SAMLConstants.SAML20P_NS, ArtifactResponse.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
validator = new ArtifactResponseSchemaValidator();
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:ArtifactResponseSchemaTest.java
示例18: testSingleElementUnmarshall
import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
ArtifactResponse ar = (ArtifactResponse) unmarshallElement(singleElementFile);
super.helperTestSingleElementUnmarshall(ar);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:7,代码来源:ArtifactResponseTest.java
示例19: testChildElementsUnmarshall
import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsUnmarshall() {
ArtifactResponse ar = (ArtifactResponse) unmarshallElement(childElementsFile);
super.helperTestChildElementsUnmarshall(ar);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:7,代码来源:ArtifactResponseTest.java
示例20: init
import org.opensaml.saml2.core.ArtifactResponse; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void init() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
MockitoAnnotations.initMocks(this);
List<String> roles = new ArrayList<String>();
roles.add("Educator");
Entity entity = new MongoEntity("user", "My User", new HashMap<String, Object>(), new HashMap<String, Object>());
principal = new SLIPrincipal();
principal.setEntity(entity);
principal.setRoles(roles);
Mockito.when(transformer.apply(eq(realm), any(LinkedMultiValueMap.class)))
.thenAnswer(new Answer<LinkedMultiValueMap<String, String>>() {
@Override
public LinkedMultiValueMap<String, String> answer(InvocationOnMock invocation) throws Throwable {
return (LinkedMultiValueMap<String, String>) invocation.getArguments()[1];
}
});
Map<String, List<String>> sliEdOrgRoleMap = new HashMap<String, List<String>>();
sliEdOrgRoleMap.put("My EdOrg", roles);
Mockito.when(edOrgRoleBuilder.buildValidStaffRoles(anyString(), anyString(), anyString(), eq(roles))).thenReturn(sliEdOrgRoleMap);
ArtifactResolve artifactResolve = Mockito.mock(ArtifactResolve.class);
Envelope envelope = Mockito.mock(Envelope.class);
Mockito.when(artifactBindingHelper.generateArtifactResolveRequest(Mockito.anyString(), Mockito.any(KeyStore.PrivateKeyEntry.class), Mockito.anyString())).thenReturn(artifactResolve);
Mockito.when(artifactBindingHelper.generateSOAPEnvelope(artifactResolve)).thenReturn(envelope);
EnvelopeImpl response = Mockito.mock(EnvelopeImpl.class);
Mockito.when(soapHelper.sendSOAPCommunication(Mockito.any(Envelope.class), Mockito.anyString(), Mockito.any(KeyStore.PrivateKeyEntry.class))).thenReturn(response);
Mockito.when(samlHelper.parseToDoc(anyString())).thenReturn(doc);
ArtifactResponse artifactResponse = Mockito.mock(ArtifactResponse.class);
List<XMLObject> artifactResponses = new ArrayList<XMLObject>();
artifactResponses.add(artifactResponse);
Body body = Mockito.mock(Body.class);
Mockito.when(response.getBody()).thenReturn(body);
Mockito.when(body.getUnknownXMLObjects()).thenReturn(artifactResponses);
samlResponse = Mockito.mock(org.opensaml.saml2.core.Response.class);
issuer = Mockito.mock(Issuer.class);
Mockito.when(artifactResponse.getMessage()).thenReturn(samlResponse);
Mockito.when(samlResponse.hasChildren()).thenReturn(true);
Mockito.when(samlResponse.getIssuer()).thenReturn(issuer);
Mockito.when(issuer.getValue()).thenReturn(issuerString);
Mockito.doNothing().when(samlHelper).validateSignature(Mockito.any(org.opensaml.saml2.core.Response.class), Mockito.any(Assertion.class));
session = Mockito.mock(Entity.class);
Mockito.when(sessionManager.getSessionForSamlId(Mockito.anyString())).thenReturn(session);
Map<String, Object> sessionBody = new HashMap<String, Object>();
sessionBody.put("requestedRealmId", "My Realm");
sessionBody.put("edOrg", "My School");
Map<String, String> code = new HashMap<String, String>();
List<Map<String, Object>> appSessions = new ArrayList<Map<String, Object>>();
appSessions.add(appSession);
code.put("value", "testAuthorizationCode");
sessionBody.put("appSession", appSessions);
appSession.put("code", code);
appSession.put("samlId", issuerString);
Mockito.when(session.getBody()).thenReturn(sessionBody);
}
开发者ID:inbloom,项目名称:secure-data-service,代码行数:75,代码来源:SamlFederationResourceTest.java
注:本文中的org.opensaml.saml2.core.ArtifactResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论