File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public void setCertificate(String certificate) {
1313 public String getIdp_sso_target_url () {
1414 return idp_sso_target_url ;
1515 }
16- public void setIdp_sso_target_url (String idp_sso_target_url ) {
16+ public void setIdpSsoTargetUrl (String idp_sso_target_url ) {
1717 this .idp_sso_target_url = idp_sso_target_url ;
1818 }
1919}
Original file line number Diff line number Diff line change 1919 " qdt/19BZrpm7zZI6BWzQKimTLS0gYpgkqbreoKK+AdbbwtyXAgMBAAEwAwYBAAMB" +
2020 " AA==" ;
2121
22+ // user account specific settings. Import the certificate here
2223 AccountSettings accountSettings = new AccountSettings ();
2324 accountSettings. setCertificate(certificateS);
2425
2526 Response samlResponse = new Response (accountSettings);
2627 samlResponse. loadXmlFromBase64(request. getParameter(" SAMLResponse" ));
2728
28- if (samlResponse. isValid()){
29+ if (samlResponse. isValid()) {
2930
31+ // the signature of the SAML Response is valid. The source is trusted
3032 java.io. PrintWriter writer = response. getWriter();
3133 writer. write(" OK!" );
3234 String nameId = samlResponse. getNameId();
3537
3638 } else {
3739
40+ // the signature of the SAML Response is not valid
3841 java.io. PrintWriter writer = response. getWriter();
3942 writer. write(" Failed" );
4043 writer. flush();
Original file line number Diff line number Diff line change 77<meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
88<title >Auth Request</title >
99<%
10+
11+ // the appSettings object contain application specific settings used by the SAML library
1012 AppSettings appSettings = new AppSettings ();
13+
14+ // set the URL of the consume.jsp (or similar) file for this app. The SAML Response will be posted to this URL
1115 appSettings. setAssertionConsumerServiceUrl(" http://68.169.49.120:8080/testOneLogin/consume.jsp" );
12- appSettings. setIssuer(" user@onelogin.com" );
16+
17+ // set the issuer of the authentication request. This would usually be the URL of the issuing web application
18+ appSettings. setIssuer(" https://www.mywebapp.com" );
19+
20+ // the accSettings object contains settings specific to the users account.
21+ // At this point, your application must have identified the users origin
1322 AccountSettings accSettings = new AccountSettings ();
14- accSettings. setIdp_sso_target_url(" https://app.onelogin.com/saml/signon/20956" );
23+
24+ // The URL at the Identity Provider where to the authentication request should be sent
25+ accSettings. setIdpSsoTargetUrl(" https://app.onelogin.com/saml/signon/20956" );
26+
27+ // Generate an AuthRequest and send it to the identity provider
1528 AuthRequest authReq = new AuthRequest (appSettings, accSettings);
1629 String reqString = accSettings. getIdp_sso_target_url()+ " ?SAMLRequest=" + AuthRequest . getRidOfCRLF(URLEncoder . encode(authReq. getRequest(AuthRequest . base64)," UTF-8" ));
1730 response. sendRedirect(reqString);
1831% >
1932</head >
2033<body >
21-
2234</body >
2335</html >
You can’t perform that action at this time.
0 commit comments