The following URLs will log out of Ping Fed/Ping One and return the user to the mytopcon front page:
This is our recommended and supported method of logging out. We intend to maintain these going forward such that they will log out of our systems.
If you have more specialied needs, the following notes may be helpful.
To create a working logout, there is an assortment of different endpoints/query parameters to contend with, each of which has its own endpoint and name for the page-to-go-to-next:
https://${trapiHost}/logout?ping=true&redirect={redirect_uri}
https://${pingFedHost}/idp/startSLO.ping?TargetResource={redirect_uri}
https://${pingOneHost}/as/signoff?post_logout_redirect_uri={redirect_uri}
post_logout_redirect_uri
has to match the configured URI exactly - no wildcards. This makes it very brittle to configure, so we would prefer to only allow redirect to MyTopcon or (in the future) the Self-Service Dashboard.We wrote the following Javascript code to generate URLs to log out of various systems; usage is
DEPLOY_ENV="qa" node logout.routes.js trapi pingone
// logout.routes.js
// code for generating logout urls:
const deployEnv = process.env.DEPLOY_ENV || "qa";
const settings = {
qa: {
trapiHost : "api-qa.topcon.com",
pingFedHost: "qa-token.auth.topcon.com",
pingOneHost: "qa-id.auth.topcon.com",
terminals : {
ssd: { url: "https://mytopcon-stg.topconpositioning.com"},
local: { url: "http://localhost:3434/logout", state:"post"},
magnet:{ url: "https://core2-beta.magnet-cloud.com/auth/callback-logout"},
}
},
prod: {
trapiHost : "api.topcon.com",
pingFedHost: "token.auth.topcon.com",
pingOneHost: "id.auth.topcon.com",
terminals : {
ssd: { url: "https://mytopcon.topconpositioning.com"},
}
}
}[deployEnv];
prefixes = {
pingone: `https://${settings.pingOneHost}/as/signoff?post_logout_redirect_uri=`,
pingfed: `https://${settings.pingFedHost}/idp/startSLO.ping?TargetResource=`,
trapi: `https://${settings.trapiHost}/logout?ping=true&redirect=`,
}
var urlState = {...settings.terminals.ssd};
process.argv.slice(2).reverse().forEach(x => {
const term=settings.terminals[x], pref=prefixes[x];
if (term && term.url) {
urlState = {...term};
} else if (pref) {
urlState = {url: pref + encodeURIComponent(urlState.url) + (urlState.state ? `&state=${urlState.state}` : '') };
} else {
console.error(`argument ${x} not understood`);
process.exit(1);
}
});
console.log(urlState.url);