Allow to use custom adapter (#5067)
* Allow to use custom adapter * fix: improve TypeScript documentation
This commit is contained in:
1 parent
7b8c691402
commit
c3c1a0fb4e
2 files changed
+8
-2
No files matched your search
+6
-2
@@ -29,7 +29,7 @@ export = Keycloak;
|
||||
declare function Keycloak(config?: string|{}): Keycloak.KeycloakInstance;
|
||||
|
||||
declare namespace Keycloak {
|
||||
type KeycloakAdapterName = 'cordova'|'default';
|
||||
type KeycloakAdapterName = 'cordova'|'default' | any;
|
||||
type KeycloakOnLoad = 'login-required'|'check-sso';
|
||||
type KeycloakResponseMode = 'query'|'fragment';
|
||||
type KeycloakResponseType = 'code'|'id_token token'|'code id_token token';
|
||||
@@ -42,7 +42,11 @@ declare namespace Keycloak {
|
||||
useNonce?: boolean;
|
||||
|
||||
/**
|
||||
* @private Undocumented.
|
||||
* Allows to use different adapter:
|
||||
*
|
||||
* - {string} default - using browser api for redirects
|
||||
* - {string} cordova - using cordova plugins
|
||||
* - {function} - allows to provide custom function as adapter.
|
||||
*/
|
||||
adapter?: KeycloakAdapterName;
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
adapter = loadAdapter('cordova');
|
||||
} else if (initOptions && initOptions.adapter === 'default') {
|
||||
adapter = loadAdapter();
|
||||
} else if (initOptions && typeof initOptions.adapter === "object") {
|
||||
adapter = initOptions.adapter;
|
||||
} else {
|
||||
if (window.Cordova || window.cordova) {
|
||||
adapter = loadAdapter('cordova');
|
||||
|
||||
Reference in new issue
Block a user