renamed Interfaces to conventions

This commit is contained in:
Kai Walter
2016-03-15 18:56:38 +01:00
parent 01b2d882bd
commit 7f6cceb3e5
+20 -73
View File
@@ -7,7 +7,7 @@ declare namespace Microsoft {
namespace ADAL {
interface IUserInfo {
interface UserInfo {
displayableId: string,
userId: string,
familyName: string,
@@ -18,11 +18,7 @@ declare namespace Microsoft {
uniqueId: string,
}
interface ITokenCache {
contextAuthority: string
}
interface ITokenCacheItem {
interface TokenCacheItem {
accessToken: string,
authority: string,
clientId: string,
@@ -31,18 +27,18 @@ declare namespace Microsoft {
isMultipleResourceRefreshToken: boolean,
resource: string,
tenantId: string,
userInfo: IUserInfo
userInfo: UserInfo
}
interface IPromise {
interface Promise {
then(doneCallBack: () => any, failCallBack?: (message: string) => any):any;
}
interface IPromiseTokenCacheItems {
then(doneCallBack: (tokenCacheItems: ITokenCacheItem[]) => any, failCallBack?: (message: string) => any):any;
interface PromiseTokenCacheItems {
then(doneCallBack: (tokenCacheItems: TokenCacheItem[]) => any, failCallBack?: (message: string) => any):any;
}
class TokenCache implements ITokenCache {
class TokenCache {
contextAuthority: string
/**
@@ -50,14 +46,14 @@ declare namespace Microsoft {
*
* @returns {Promise} Promise either fulfilled when operation is completed or rejected with error.
*/
clear(): IPromise;
clear(): Promise;
/**
* Gets all cached items.
*
* @returns {Promise} Promise either fulfilled with array of cached items or rejected with error.
*/
readItems(): IPromiseTokenCacheItems;
readItems(): PromiseTokenCacheItems;
/**
* Deletes cached item.
@@ -66,22 +62,10 @@ declare namespace Microsoft {
*
* @returns {Promise} Promise either fulfilled when operation is completed or rejected with error.
*/
deleteItem(item: ITokenCacheItem): IPromise;
deleteItem(item: TokenCacheItem): Promise;
}
interface IAuthenticationResult {
accessToken: string,
accessTokenType: string,
expiresOn: Date,
idToken: string,
isMultipleResourceRefreshToken: boolean,
status: string,
statusCode: string,
tenantId: string,
userInfo: IUserInfo
}
class AuthenticationResult implements IAuthenticationResult {
class AuthenticationResult {
accessToken: string;
accessTokenType: string;
expiresOn: Date;
@@ -90,7 +74,7 @@ declare namespace Microsoft {
status: string;
statusCode: string;
tenantId: string;
userInfo: IUserInfo;
userInfo: UserInfo;
/**
* Creates authorization header for web requests.
@@ -100,52 +84,15 @@ declare namespace Microsoft {
createAuthorizationHeader(): string;
}
interface IPromiseAuthenticationResult {
then(doneCallBack: (context: IAuthenticationResult) => any, failCallBack?: (message: string) => any):any;
interface PromiseAuthenticationResult {
then(doneCallBack: (context: AuthenticationResult) => any, failCallBack?: (message: string) => any):any;
}
interface IAuthenticationContext {
authority: string,
validateAuthority: boolean,
tokenCache: TokenCache
/**
* Acquires token using interactive flow if needed. It checks the cache to return existing result
* if not expired. It tries to use refresh token if available. If it fails to get token with
* refresh token, it will remove this refresh token from cache and start authentication.
*
* @param {String} resourceUrl Resource identifier
* @param {String} clientId Client (application) identifier
* @param {String} redirectUrl Redirect url for this application
* @param {String} userId User identifier (optional)
* @param {String} extraQueryParameters
* Extra query parameters (optional)
* Parameters should be escaped before passing to this method (e.g. using 'encodeURI()')
*
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
*/
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: string): IPromiseAuthenticationResult;
/**
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
* if not expired. It tries to use refresh token if available. If it fails to get token without
* displaying UI it will fail. This method guarantees that no UI will be shown to user.
*
* @param {String} resourceUrl Resource identifier
* @param {String} clientId Client (application) identifier
* @param {String} userId User identifier (optional)
*
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
*/
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): IPromiseAuthenticationResult;
interface PromiseAuthenticationContext {
then(doneCallBack: (context: AuthenticationContext) => any, failCallBack?: (message: string) => any):any;
}
interface IPromiseAuthenticationContext {
then(doneCallBack: (context: IAuthenticationContext) => any, failCallBack?: (message: string) => any):any;
}
class AuthenticationContext implements IAuthenticationContext {
class AuthenticationContext implements AuthenticationContext {
authority: string;
validateAuthority: boolean;
tokenCache: TokenCache;
@@ -174,7 +121,7 @@ declare namespace Microsoft {
*
* @returns {Promise} Promise either fulfilled with newly created authentication context or rejected with error
*/
static createAsync(authority: string, validateAuthority?: boolean): IPromiseAuthenticationContext;
static createAsync(authority: string, validateAuthority?: boolean): PromiseAuthenticationContext;
/**
* Acquires token using interactive flow if needed. It checks the cache to return existing result
@@ -191,7 +138,7 @@ declare namespace Microsoft {
*
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
*/
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: string): IPromiseAuthenticationResult;
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: string): PromiseAuthenticationResult;
/**
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
@@ -204,7 +151,7 @@ declare namespace Microsoft {
*
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
*/
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): IPromiseAuthenticationResult;
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): PromiseAuthenticationResult;
}
}