landstrasse
Version:
Strongly typed WAMP Client for browsers
34 lines • 1.11 kB
JavaScript
import AbstractAuthProvider from './AbstractAuthProvider';
/**
* Ticket authentication provider.
*
* This can be used to login with username and password or any other sort of static token.
*/
class TicketAuthProvider extends AbstractAuthProvider {
/**
* Creates a new instance of the ticket provider.
*
* @param authId - The username to send to the server.
* @param ticketFunction - A callback used to retrieve the token/password.
* @param authMethod - Name of the authmethod (default: 'ticket').
*/
constructor(authId, ticketFunction, authMethod = 'ticket') {
super(authId, authMethod);
Object.defineProperty(this, "_ticketFunction", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this._ticketFunction = ticketFunction;
}
get isTransportLevel() {
return false;
}
/** @inheritDoc */
computeChallenge(authExtra) {
return this._ticketFunction(authExtra);
}
}
export default TicketAuthProvider;
//# sourceMappingURL=Ticket.js.map