Skip to content

Instantly share code, notes, and snippets.

View lurodrig's full-sized avatar

Luis Rodríguez Fernández lurodrig

View GitHub Profile
<samlp:Response ID="_cabc2708-7639-4500-ad89-bfb0e8714f0a"
Version="2.0"
IssueInstant="2018-05-16T09:42:53.744Z"
Destination="https://.../examples/saml"
Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
InResponseTo="..."
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
>
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://cern.ch/login</Issuer>
<samlp:Status>
<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
Destination="https://login.cern.ch/adfs/ls/?wa=wsignout1.0"
ID="..."
IssueInstant="2018-05-17T09:35:31.362Z"
Version="2.0"
>
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://.../examples/</saml:Issuer>
<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
Destination="https://login.cern.ch/adfs/ls/"
ForceAuthn="false"
ID="xxxxxx"
IsPassive="false"
IssueInstant="2018-05-28T10:06:40.189Z"
Version="2.0"
>
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://my.app.com/examples/</saml:Issuer>
package sso.cross.context.security.filter;
import java.io.IOException;
import java.util.Base64;
import java.util.Optional;
import java.util.stream.Stream;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
package cross.context.test.suite;
import java.io.IOException;
import java.util.Base64;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<web-app>
<module-name>login-module</module-name>
<servlet>
<servlet-name>RedirectServlet</servlet-name>
<servlet-class>cross.context.test.suite.RedirectServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RedirectServlet</servlet-name>
<web-app>
<module-name>web-module-1</module-name>
<filter>
<filter-name>CustomSecurityFilter</filter-name>
<filter-class>cross.context.security.filter.CustomSecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CustomSecurityFilter</filter-name>
<html>
<head>
<title>Sample "Hello, World" Application</title>
<script type="text/javascript">
function crossContextRequest() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4
if (xmlhttp.status == 200) {
@lurodrig
lurodrig / .java
Last active November 13, 2018 17:23
import org.openqa.selenium.WebDriver;
static WebDriver browser;
@Before
public void initBrowser() {
HtmlUnitTestDriver d = new HtmlUnitTestDriver();
d.getWebClient().getOptions().setJavaScriptEnabled(true);
d.getWebClient().getOptions().setCssEnabled(false);
{
"id": "demo",
"realm": "demo",
"enabled": true,
"sslRequired": "external",
"registrationAllowed": true,
"resetPasswordAllowed": true,
"privateKey": "MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=",
"publicKey": "MIGfMA0GCSqG