mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-04 00:13:06 +08:00
fix(ms-adal): Update createAuthenticationContext (#2705)
* Update createAuthenticationContext Update createAuthenticationContext to include validateAuthority flag since it is throwing Error: Fail to valid authority with errors: [50049]. Without the flag it is throwing Error: Fail to valid authority with errors: [50049]. * Update index.ts
This commit is contained in:
parent
6a9a871758
commit
890129bfda
@ -1,8 +1,7 @@
|
|||||||
import { Plugin, IonicNativePlugin, checkAvailability, InstanceProperty, CordovaInstance } from '@ionic-native/core';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { checkAvailability, CordovaInstance, InstanceProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||||
|
|
||||||
export interface AuthenticationResult {
|
export interface AuthenticationResult {
|
||||||
|
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
accesSTokenType: string;
|
accesSTokenType: string;
|
||||||
expiresOn: Date;
|
expiresOn: Date;
|
||||||
@ -18,7 +17,6 @@ export interface AuthenticationResult {
|
|||||||
* @returns {String} The authorization header.
|
* @returns {String} The authorization header.
|
||||||
*/
|
*/
|
||||||
createAuthorizationHeader(): string;
|
createAuthorizationHeader(): string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TokenCache {
|
export interface TokenCache {
|
||||||
@ -50,7 +48,6 @@ export interface UserInfo {
|
|||||||
uniqueId: string;
|
uniqueId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name MS ADAL
|
* @name MS ADAL
|
||||||
* @description
|
* @description
|
||||||
@ -96,22 +93,28 @@ export interface UserInfo {
|
|||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MSAdal extends IonicNativePlugin {
|
export class MSAdal extends IonicNativePlugin {
|
||||||
|
createAuthenticationContext(
|
||||||
createAuthenticationContext(authority: string, validateAuthority: boolean = true) {
|
authority: string,
|
||||||
|
validateAuthority: boolean = true
|
||||||
|
) {
|
||||||
let authContext: any;
|
let authContext: any;
|
||||||
if (checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) === true) {
|
if (
|
||||||
authContext = new (MSAdal.getPlugin()).AuthenticationContext(authority);
|
checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) ===
|
||||||
|
true
|
||||||
|
) {
|
||||||
|
authContext = new (MSAdal.getPlugin()).AuthenticationContext(
|
||||||
|
authority,
|
||||||
|
validateAuthority
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return new AuthenticationContext(authContext);
|
return new AuthenticationContext(authContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
export class AuthenticationContext {
|
export class AuthenticationContext {
|
||||||
|
|
||||||
@InstanceProperty
|
@InstanceProperty
|
||||||
authority: string;
|
authority: string;
|
||||||
|
|
||||||
@ -138,7 +141,15 @@ export class AuthenticationContext {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
otherPromise: true
|
otherPromise: true
|
||||||
})
|
})
|
||||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any): Promise<AuthenticationResult> { return; }
|
acquireTokenAsync(
|
||||||
|
resourceUrl: string,
|
||||||
|
clientId: string,
|
||||||
|
redirectUrl: string,
|
||||||
|
userId?: string,
|
||||||
|
extraQueryParameters?: any
|
||||||
|
): Promise<AuthenticationResult> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
|
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
|
||||||
@ -153,6 +164,11 @@ export class AuthenticationContext {
|
|||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
otherPromise: true
|
otherPromise: true
|
||||||
})
|
})
|
||||||
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId?: string): Promise<AuthenticationResult> { return; }
|
acquireTokenSilentAsync(
|
||||||
|
resourceUrl: string,
|
||||||
|
clientId: string,
|
||||||
|
userId?: string
|
||||||
|
): Promise<AuthenticationResult> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user