Static CreateCreates a directory session.
Warning : creating a directory session from Host / Path / Port is now deprecated, please use the url signature.
The directory session object, that will try the authentication upon calling the authenticate functions.
Optional pDirectoryPath: stringOptional pDirectoryPort: numberStatic DecodeDecodes the hash content and sends the token to the caller of getPopupBasedAuthenticationUrl in case of popup based authentications.
This will trigger the LoginSuccess signal on the tab that called getPopupBasedAuthenticationUrl.
This function makes use of the LocalStorage of the browser.
/**
* Sample to illustrate the use of the authentication in the popup based authentication.
*/
import { DirectorySessionFactory } from 'generated/documentation/appinfiniteapi';
if (window.location.hash)
{
// try to decode the authentication hash.
if (!DirectorySessionFactory.DecodeAuthenticationHash(window.location.hash))
{
// output some debug error message.
console.log('Error: unable to decode hash content of authentication');
// display error
const lError: HTMLElement = <HTMLElement>document.getElementById('error');
lError.textContent = 'Unable to decode hash content of authentication';
}
else {
// everything is fine, the other tab is notified
// just need to close the tab
window.close();
}
}
else
{
// we have no hash => go back to main page
// get the url content
const lPath = window.location.pathname;
const lOffset : number = lPath.lastIndexOf('/');
// replace 'authentication.html' by main page 'index.html'
if (lOffset >= 0)
{
// create new location
const sLocation = window.location.origin + lPath.substring(0, lOffset) + '/index.html';
// ang go
window.location.href = sLocation;
}
}
true if the hash was correctly decoded.
The DirectorySessionFactory factory allows to create a DirectorySessionInterface to authenticate onto a 3djuump Infinite directory.
It also provides also a way to decode authentication hashes that are retrieved on the authentication hashes in case of popup based authentication. The authentication system is based on OpenID Connect layer.
The directory session will try to connect to the given Host, and is bound to a MetadataManagerInterface.
Please refer to Authentication Samples for more explanations about Sessions.
See
DirectorySessionInterface