| | 72 | // Add an Assertion of this authenticated user |
|---|
| | 73 | AssertionBuilder ab = (AssertionBuilder) builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME); |
|---|
| | 74 | Assertion as = ab.buildObject(); |
|---|
| | 75 | // Build the AuthnStatement itself |
|---|
| | 76 | AuthnStatementBuilder asb = (AuthnStatementBuilder) builderFactory.getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME); |
|---|
| | 77 | AuthnStatement ans = asb.buildObject(); |
|---|
| | 78 | ans.set |
|---|
| | 79 | |
|---|
| | 80 | // Now add a subject to the response |
|---|
| | 81 | SubjectBuilder sb = (SubjectBuilder) builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME); |
|---|
| | 82 | Subject sub = sb.buildObject(); |
|---|
| | 83 | NameIDBuilder nidb = (NameIDBuilder) builderFactory.getBuilder(NameID.DEFAULT_ELEMENT_NAME); |
|---|
| | 84 | NameID nid = nidb.buildObject(); |
|---|
| | 85 | nid.setValue(idpLoginId); |
|---|
| | 86 | sub.setNameID(nid); |
|---|
| | 87 | |
|---|
| | 88 | |
|---|
| 72 | | HTTPPostEncoder encoder = new HTTPPostEncoder(); |
|---|
| 73 | | encoder.setSAMLMessage(rsp); |
|---|
| | 90 | Marshaller marshaller = org.opensaml.Configuration.getMarshallerFactory().getMarshaller(rsp); |
|---|
| | 91 | Element authDOM = marshaller.marshall(rsp); |
|---|
| | 92 | StringWriter rspWrt = new StringWriter(); |
|---|
| | 93 | XMLHelper.writeNode(authDOM, rspWrt); |
|---|
| | 94 | String messageXML = rspWrt.toString(); |
|---|
| | 95 | |
|---|
| | 96 | String samlResponse = new String(Base64.encodeBytes(messageXML.getBytes(), Base64.DONT_BREAK_LINES)); |
|---|
| 79 | | encoder.encode(); |
|---|
| | 100 | messageXML = messageXML.replace("<", "<"); |
|---|
| | 101 | messageXML = messageXML.replace(">", ">"); |
|---|
| | 102 | %> |
|---|
| | 103 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|---|
| | 104 | "http://www.w3.org/TR/html4/loose.dtd"> |
|---|
| | 105 | <html> |
|---|
| | 106 | <head> |
|---|
| | 107 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|---|
| | 108 | <title>ACME Idp Login</title> |
|---|
| | 109 | <link rel="stylesheet" type="text/css" href="main.css"> |
|---|
| | 110 | </head> |
|---|
| | 111 | <body> |
|---|
| | 112 | <p>Please press the continue button to proceed.</p> |
|---|
| | 113 | <form action="<% out.print(actionURL); %>" method="post"> |
|---|
| | 114 | <input type="hidden" name="RelayState" value="<% out.print(relayState); %>"> |
|---|
| | 115 | <input type="hidden" name="SAMLResponse" value="<% out.print(samlResponse); %>"> |
|---|
| | 116 | <input type="submit" value="Continue"> |
|---|
| | 117 | </form> |
|---|
| | 118 | |
|---|
| | 119 | <p> |
|---|
| | 120 | <%out.print(messageXML);%> |
|---|
| | 121 | </p> |
|---|
| | 122 | </body> |
|---|
| | 123 | </html> |
|---|
| | 124 | <% |
|---|