Skip to content

Instantly share code, notes, and snippets.

@samuelgoto
Last active June 17, 2022 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelgoto/d158bbfe8b4089b3feb737f49e6268a3 to your computer and use it in GitHub Desktop.
Save samuelgoto/d158bbfe8b4089b3feb737f49e6268a3 to your computer and use it in GitHub Desktop.

login.php

<html>
try {
  const credential = await navigator.credentials.store(new FederatedCredential({
    rp: "https://springer.com",
    user: {name: "David", picture: "..."}
  }));
  // do stuff
  window.location.href = "https://springer.com/?saml_resonse?" + ...;
} catch (e) {
  alert("oops");
}
</html>

logout.php

<html>
try {
  const serviceProviders = [{
     url: "https://springer.com/logout.php"
  }];
  const sessionDuringFilter = () = {};
  FederatedCredential.logoutRps(serviceProvider.filter(sessionDurationFilter));
} catch (e) {
  alert("oops");
}
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment