feat: update keycloak theme
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
import * as React from "../../../common/keycloak/web_modules/react.js";
|
||||
import * as React from "../../keycloak.v2/web_modules/react.js";
|
||||
export const KeycloakContext = React.createContext(undefined);
|
||||
//# sourceMappingURL=KeycloakContext.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/app/keycloak-service/KeycloakContext.tsx"],"names":["React","KeycloakContext","createContext","undefined"],"mappings":"AAAA,OAAO,KAAKA,KAAZ;AAGA,OAAO,MAAMC,eAAe,GAAGD,KAAK,CAACE,aAAN,CAAiDC,SAAjD,CAAxB","sourcesContent":["import * as React from 'react';\nimport { KeycloakService } from './keycloak.service';\n\nexport const KeycloakContext = React.createContext<KeycloakService | undefined>(undefined);"],"file":"KeycloakContext.js"}
|
||||
{"version":3,"file":"KeycloakContext.js","names":["React","KeycloakContext","createContext","undefined"],"sources":["../../src/app/keycloak-service/KeycloakContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { KeycloakService } from './keycloak.service';\n\nexport const KeycloakContext = React.createContext<KeycloakService | undefined>(undefined);"],"mappings":"AAAA,OAAO,KAAKA,KAAK;AAGjB,OAAO,MAAMC,eAAe,GAAGD,KAAK,CAACE,aAAa,CAA8BC,SAAS,CAAC"}
|
||||
@@ -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
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/app/keycloak-service/keycloak.service.ts"],"names":["KeycloakService","constructor","keycloak","keycloakAuth","authenticated","audiencePresent","tokenParsed","audience","Array","isArray","indexOf","login","options","logout","redirectUri","baseUrl","account","accountManagement","authServerUrl","charAt","length","realm","getToken","Promise","resolve","reject","token","updateToken","success","error"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,OAAO,MAAMA,eAAN,CAAsB;AAGlBC,EAAAA,WAAW,CAACC,QAAD,EAA2B;AAAA;;AACzC,SAAKC,YAAL,GAAoBD,QAApB;AACH;;AAEME,EAAAA,aAAa,GAAY;AAC5B,WAAO,KAAKD,YAAL,CAAkBC,aAAlB,GAAkC,KAAKD,YAAL,CAAkBC,aAApD,GAAoE,KAA3E;AACH;;AAEMC,EAAAA,eAAe,GAAY;AAC9B,QAAI,KAAKF,YAAL,CAAkBG,WAAtB,EAAmC;AAC/B,YAAMC,QAAQ,GAAG,KAAKJ,YAAL,CAAkBG,WAAlB,CAA8B,KAA9B,CAAjB;AACA,aAAOC,QAAQ,KAAK,SAAb,IAA2BC,KAAK,CAACC,OAAN,CAAcF,QAAd,KAA2BA,QAAQ,CAACG,OAAT,CAAiB,SAAjB,KAA+B,CAA5F;AACH;;AACD,WAAO,KAAP;AACH;;AAEMC,EAAAA,KAAK,CAACC,OAAD,EAAuC;AAC/C,SAAKT,YAAL,CAAkBQ,KAAlB,CAAwBC,OAAxB;AACH;;AAEMC,EAAAA,MAAM,CAACC,WAAmB,GAAGC,OAAvB,EAAsC;AAC/C,SAAKZ,YAAL,CAAkBU,MAAlB,CAAyB;AAACC,MAAAA,WAAW,EAAEA;AAAd,KAAzB;AACH;;AAEME,EAAAA,OAAO,GAAS;AACnB,SAAKb,YAAL,CAAkBc,iBAAlB;AACH;;AAEMC,EAAAA,aAAa,GAAuB;AACvC,UAAMA,aAAa,GAAG,KAAKf,YAAL,CAAkBe,aAAxC;AACA,WAAOA,aAAa,CAAEC,MAAf,CAAsBD,aAAa,CAAEE,MAAf,GAAwB,CAA9C,MAAqD,GAArD,GAA2DF,aAA3D,GAA2EA,aAAa,GAAG,GAAlG;AACH;;AAEMG,EAAAA,KAAK,GAAuB;AAC/B,WAAO,KAAKlB,YAAL,CAAkBkB,KAAzB;AACH;;AAEMC,EAAAA,QAAQ,GAAoB;AAC/B,WAAO,IAAIC,OAAJ,CAAoB,CAACC,OAAD,EAAUC,MAAV,KAAqB;AAC5C,UAAI,KAAKtB,YAAL,CAAkBuB,KAAtB,EAA6B;AACzB,aAAKvB,YAAL,CACKwB,WADL,CACiB,CADjB,EAEKC,OAFL,CAEa,MAAM;AACXJ,UAAAA,OAAO,CAAC,KAAKrB,YAAL,CAAkBuB,KAAnB,CAAP;AACH,SAJL,EAKKG,KALL,CAKW,MAAM;AACTJ,UAAAA,MAAM,CAAC,yBAAD,CAAN;AACH,SAPL;AAQH,OATD,MASO;AACHA,QAAAA,MAAM,CAAC,eAAD,CAAN;AACH;AACJ,KAbM,CAAP;AAcH;;AAvDwB","sourcesContent":["/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Keycloak, { KeycloakLoginOptions } from \"../../../../../../../../../../adapters/oidc/js\";\n\ndeclare const baseUrl: string;\nexport type KeycloakClient = Keycloak;\n\nexport class KeycloakService {\n private keycloakAuth: KeycloakClient;\n\n public constructor(keycloak: KeycloakClient) {\n this.keycloakAuth = keycloak;\n }\n\n public authenticated(): boolean {\n return this.keycloakAuth.authenticated ? this.keycloakAuth.authenticated : false;\n }\n\n public audiencePresent(): boolean {\n if (this.keycloakAuth.tokenParsed) {\n const audience = this.keycloakAuth.tokenParsed['aud'];\n return audience === 'account' || (Array.isArray(audience) && audience.indexOf('account') >= 0);\n }\n return false;\n }\n\n public login(options?: KeycloakLoginOptions): void {\n this.keycloakAuth.login(options);\n }\n\n public logout(redirectUri: string = baseUrl): void {\n this.keycloakAuth.logout({redirectUri: redirectUri});\n }\n\n public account(): void {\n this.keycloakAuth.accountManagement();\n }\n\n public authServerUrl(): string | undefined {\n const authServerUrl = this.keycloakAuth.authServerUrl;\n return authServerUrl!.charAt(authServerUrl!.length - 1) === '/' ? authServerUrl : authServerUrl + '/';\n }\n\n public realm(): string | undefined {\n return this.keycloakAuth.realm;\n }\n\n public getToken(): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n if (this.keycloakAuth.token) {\n this.keycloakAuth\n .updateToken(5)\n .success(() => {\n resolve(this.keycloakAuth.token as string);\n })\n .error(() => {\n reject('Failed to refresh token');\n });\n } else {\n reject('Not logged in');\n }\n });\n }\n}\n"],"file":"keycloak.service.js"}
|
||||
{"version":3,"file":"keycloak.service.js","names":["KeycloakService","constructor","keycloak","_defineProperty","keycloakAuth","authenticated","audiencePresent","tokenParsed","audience","Array","isArray","indexOf","login","options","logout","redirectUri","baseUrl","account","accountManagement","authServerUrl","charAt","length","realm","getToken","Promise","resolve","reject","token","updateToken","then","catch"],"sources":["../../src/app/keycloak-service/keycloak.service.ts"],"sourcesContent":["/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Keycloak, { KeycloakLoginOptions } from \"../../../../../../../../../../js/libs/keycloak-js\";\n\ndeclare const baseUrl: string;\nexport type KeycloakClient = Keycloak;\n\nexport class KeycloakService {\n private keycloakAuth: KeycloakClient;\n\n public constructor(keycloak: KeycloakClient) {\n this.keycloakAuth = keycloak;\n }\n\n public authenticated(): boolean {\n return this.keycloakAuth.authenticated ? this.keycloakAuth.authenticated : false;\n }\n\n public audiencePresent(): boolean {\n if (this.keycloakAuth.tokenParsed) {\n const audience = this.keycloakAuth.tokenParsed['aud'];\n return audience === 'account' || (Array.isArray(audience) && audience.indexOf('account') >= 0);\n }\n return false;\n }\n\n public login(options?: KeycloakLoginOptions): void {\n this.keycloakAuth.login(options);\n }\n\n public logout(redirectUri: string = baseUrl): void {\n this.keycloakAuth.logout({redirectUri: redirectUri});\n }\n\n public account(): void {\n this.keycloakAuth.accountManagement();\n }\n\n public authServerUrl(): string | undefined {\n const authServerUrl = this.keycloakAuth.authServerUrl;\n return authServerUrl!.charAt(authServerUrl!.length - 1) === '/' ? authServerUrl : authServerUrl + '/';\n }\n\n public realm(): string | undefined {\n return this.keycloakAuth.realm;\n }\n\n public getToken(): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n if (this.keycloakAuth.token) {\n this.keycloakAuth\n .updateToken(5)\n .then(() => {\n resolve(this.keycloakAuth.token as string);\n })\n .catch(() => {\n reject('Failed to refresh token');\n });\n } else {\n reject('Not logged in');\n }\n });\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,MAAMA,eAAe,CAAC;EAGlBC,WAAWA,CAACC,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