download
raw
1.28 kB
import { CodeChallengeMethod, OAuth2Client } from "../client.js";
export class KeyCloak {
authorizationEndpoint;
tokenEndpoint;
tokenRevocationEndpoint;
client;
constructor(realmURL, clientId, clientSecret, redirectURI) {
this.authorizationEndpoint = realmURL + "/protocol/openid-connect/auth";
this.tokenEndpoint = realmURL + "/protocol/openid-connect/token";
this.tokenRevocationEndpoint = realmURL + "/protocol/openid-connect/revoke";
this.client = new OAuth2Client(clientId, clientSecret, redirectURI);
}
createAuthorizationURL(state, codeVerifier, scopes) {
const url = this.client.createAuthorizationURLWithPKCE(this.authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
return url;
}
async validateAuthorizationCode(code, codeVerifier) {
const tokens = await this.client.validateAuthorizationCode(this.tokenEndpoint, code, codeVerifier);
return tokens;
}
async refreshAccessToken(refreshToken) {
const tokens = await this.client.refreshAccessToken(this.tokenEndpoint, refreshToken, []);
return tokens;
}
async revokeToken(token) {
await this.client.revokeToken(this.tokenRevocationEndpoint, token);
}
}

Xet Storage Details

Size:
1.28 kB
·
Xet hash:
3c19f10d27ff66297637bb2b73e0e100dfdbfe6c705db11ca1f589addacfc53e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.