feat: update keycloak theme
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
/*
|
||||
* Copyright 2017 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
@@ -16,55 +17,46 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class KeycloakService {
|
||||
constructor(keycloak) {
|
||||
_defineProperty(this, "keycloakAuth", void 0);
|
||||
|
||||
this.keycloakAuth = keycloak;
|
||||
}
|
||||
|
||||
authenticated() {
|
||||
return this.keycloakAuth.authenticated ? this.keycloakAuth.authenticated : false;
|
||||
}
|
||||
|
||||
audiencePresent() {
|
||||
if (this.keycloakAuth.tokenParsed) {
|
||||
const audience = this.keycloakAuth.tokenParsed['aud'];
|
||||
return audience === 'account' || Array.isArray(audience) && audience.indexOf('account') >= 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
login(options) {
|
||||
this.keycloakAuth.login(options);
|
||||
}
|
||||
|
||||
logout(redirectUri = baseUrl) {
|
||||
this.keycloakAuth.logout({
|
||||
redirectUri: redirectUri
|
||||
});
|
||||
}
|
||||
|
||||
account() {
|
||||
this.keycloakAuth.accountManagement();
|
||||
}
|
||||
|
||||
authServerUrl() {
|
||||
const authServerUrl = this.keycloakAuth.authServerUrl;
|
||||
return authServerUrl.charAt(authServerUrl.length - 1) === '/' ? authServerUrl : authServerUrl + '/';
|
||||
}
|
||||
|
||||
realm() {
|
||||
return this.keycloakAuth.realm;
|
||||
}
|
||||
|
||||
getToken() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.keycloakAuth.token) {
|
||||
this.keycloakAuth.updateToken(5).success(() => {
|
||||
this.keycloakAuth.updateToken(5).then(() => {
|
||||
resolve(this.keycloakAuth.token);
|
||||
}).error(() => {
|
||||
}).catch(() => {
|
||||
reject('Failed to refresh token');
|
||||
});
|
||||
} else {
|
||||
@@ -72,6 +64,5 @@ export class KeycloakService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//# sourceMappingURL=keycloak.service.js.map
|
||||
Reference in New Issue
Block a user