From 87ad3c1bcb666ed1913e14142cd2ea43f3f32110 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Wed, 3 Jan 2018 10:01:31 -0800 Subject: [PATCH] Remove @types/adal in favor of @types/adal-angular (#22565) --- types/adal/adal-angular.d.ts | 40 -------- types/adal/index.d.ts | 179 ----------------------------------- types/adal/test/angular.ts | 46 --------- types/adal/test/index.ts | 24 ----- types/adal/tsconfig.json | 26 ----- types/adal/tslint.json | 79 ---------------- 6 files changed, 394 deletions(-) delete mode 100644 types/adal/adal-angular.d.ts delete mode 100644 types/adal/index.d.ts delete mode 100644 types/adal/test/angular.ts delete mode 100644 types/adal/test/index.ts delete mode 100644 types/adal/tsconfig.json delete mode 100644 types/adal/tslint.json diff --git a/types/adal/adal-angular.d.ts b/types/adal/adal-angular.d.ts deleted file mode 100644 index 28d9682f19..0000000000 --- a/types/adal/adal-angular.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Type definitions for ADAL.JS 1.0.8 -// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js -// Definitions by: mmaitre314 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare namespace adal { - - interface AdalAuthenticationServiceProvider { - init(configOptions: Config, httpProvider: angular.IHttpProvider): void; - } - - interface UserInfo { - isAuthenticated: boolean, - userName: string, - loginError: string, - profile: any - } - - interface AdalAuthenticationService { - - config: Config; - userInfo: UserInfo, - - login(): void; - loginInProgress(): boolean; - logOut(): void; - getCachedToken(resource: string): string; - acquireToken(resource: string): angular.IPromise; - getUser(): angular.IPromise; - getResourceForEndpoint(endpoint: string): string, - clearCache(): void; - clearCacheForResource(resource: string): void; - info(message: string): void; - verbose(message: string): void; - } - -} \ No newline at end of file diff --git a/types/adal/index.d.ts b/types/adal/index.d.ts deleted file mode 100644 index a51933b734..0000000000 --- a/types/adal/index.d.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Type definitions for ADAL.JS 1.0.14 -// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js -// Definitions by: mmaitre314 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -declare var AuthenticationContext: adal.AuthenticationContextStatic; -declare var Logging: adal.Logging; - -declare module 'adal' { - export const AuthenticationContext: adal.AuthenticationContextStatic; - export const Logging: adal.Logging; -} - -declare namespace adal { - - interface Config { - tenant?: string; - clientId: string; - redirectUri?: string; - instance?: string; - endpoints?: any; // If you need to send CORS api requests. - popUp?: boolean; - localLoginUrl?: string; - displayCall?: (urlNavigate: string) => any; - postLogoutRedirectUri?: string; // redirect url after succesful logout operation - cacheLocation?: string; - anonymousEndpoints?: string[]; - expireOffsetSeconds?: number; - correlationId?: string; - loginResource?: string; - resource?: string; - extraQueryParameter?: string; - navigateToLoginRequestUrl?: boolean; - logOutUri?: string; - isAngular?: boolean; - } - - interface User { - userName: string; - profile: any; - } - - interface RequestInfo { - valid: boolean; - parameters: any; - stateMatch: boolean; - stateResponse: string; - requestType: string; - } - - interface Logging { - log: (message: string) => void; - level: LoggingLevel; - } - - enum LoggingLevel { - ERROR = 0, - WARNING = 1, - INFO = 2, - VERBOSE = 3 - } - - interface AuthenticationContextStatic { - new (config: Config): AuthenticationContext; - } - - interface AuthenticationContext { - - instance: string; - config: Config; - - /** - * Gets initial Idtoken for the app backend - * Saves the resulting Idtoken in localStorage. - */ - login(): void; - - /** - * Indicates whether login is in progress now or not. - */ - loginInProgress(): boolean; - - /** - * Gets token for the specified resource from local storage cache - * @param {string} resource A URI that identifies the resource for which the token is valid. - * @returns {string} token if exists and not expired or null - */ - getCachedToken(resource: string): string; - - /** - * Retrieves and parse idToken from localstorage - * @returns {User} user object - */ - getCachedUser(): User; - - registerCallback(expectedState: string, resource: string, callback: (message: string, token: string) => any): void; - - /** - * Acquire token from cache if not expired and available. Acquires token from iframe if expired. - * @param {string} resource ResourceUri identifying the target resource - * @param {requestCallback} callback - */ - acquireToken(resource: string, callback: (message: string, token: string) => any): void; - - /** - * Redirect the Browser to Azure AD Authorization endpoint - * @param {string} urlNavigate The authorization request url - */ - promptUser(urlNavigate: string): void; - - /** - * Clear cache items. - */ - clearCache(): void; - - /** - * Clear cache items for a resource. - */ - clearCacheForResource(resource: string): void; - - /** - * Logout user will redirect page to logout endpoint. - * After logout, it will redirect to post_logout page if provided. - */ - logOut(): void; - - /** - * Gets a user profile - * @param {requestCallback} callback - The callback that handles the response. - */ - getUser(callback: (message: string, user?: User) => any): void; - - /** - * Checks if hash contains access token or id token or error_description - * @param {string} hash - Hash passed from redirect page - * @returns {Boolean} - */ - isCallback(hash: string): boolean; - - /** - * Gets login error - * @returns {string} error message related to login - */ - getLoginError(): string; - - /** - * Gets requestInfo from given hash. - * @returns {RequestInfo} for appropriate hash. - */ - getRequestInfo(hash: string): RequestInfo; - - /** - * Saves token from hash that is received from redirect. - */ - saveTokenFromHash(requestInfo: RequestInfo): void; - - /** - * Gets resource for given endpoint if mapping is provided with config. - * @param {string} endpoint - API endpoint - * @returns {string} resource for this API endpoint - */ - getResourceForEndpoint(endpoint: string): string; - - /** - * Handles redirection after login operation. - * Gets access token from url and saves token to the (local/session) storage - * or saves error in case unsuccessful login. - */ - handleWindowCallback(): void; - - log(level: number, message: string, error: any): void; - error(message: string, error: any): void; - warn(message: string): void; - info(message: string): void; - verbose(message: string): void; - } - -} diff --git a/types/adal/test/angular.ts b/types/adal/test/angular.ts deleted file mode 100644 index 64ab64c898..0000000000 --- a/types/adal/test/angular.ts +++ /dev/null @@ -1,46 +0,0 @@ - - -// Code samples from: -// - https://github.com/AzureAD/azure-activedirectory-library-for-js -// - https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp - -// Variable provided by AngularJS -var $httpProvider: angular.IHttpProvider = null; -var adalAuthenticationServiceProvider: adal.AdalAuthenticationServiceProvider = null; -var adalAuthenticationService: adal.AdalAuthenticationService = null; - -var endpoints = { - "https://yourhost/api": "b6a68585-5287-45b2-ba82-383ba1f60932", -}; -adalAuthenticationServiceProvider.init({ - tenant: "52d4b072-9470-49fb-8721-bc3a1c9912a1", - clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e", - endpoints: endpoints - }, - $httpProvider -); - -adalAuthenticationServiceProvider.init({ - clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e" - }, - $httpProvider -); - -adalAuthenticationServiceProvider.init( - { - clientId: 'cb68f72f...', - cacheLocation: 'localStorage' - }, - $httpProvider // pass http provider to inject request interceptor to attach tokens -); - -adalAuthenticationServiceProvider.init({ - tenant: 'Enter your tenant name here e.g. contoso.onmicrosoft.com', - clientId: 'Enter your client ID here e.g. e9a5a8b6-8af7-4719-9821-0deef255f68e', - extraQueryParameter: 'nux=1' - }, - $httpProvider -); - -adalAuthenticationService.login(); -adalAuthenticationService.logOut(); diff --git a/types/adal/test/index.ts b/types/adal/test/index.ts deleted file mode 100644 index 32a6715222..0000000000 --- a/types/adal/test/index.ts +++ /dev/null @@ -1,24 +0,0 @@ - - -var endpoints = { - "https://yourhost/api": "b6a68585-5287-45b2-ba82-383ba1f60932", -}; - -var config : adal.Config = { - tenant: "52d4b072-9470-49fb-8721-bc3a1c9912a1", // Optional by default, it sends common - clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e", // Required - endpoints: endpoints // If you need to send CORS api requests. -}; - -var auth = new AuthenticationContext(config); - -Logging.log = (message: string) => { - console.log(message); -} - -Logging.level = 4; - -auth.info("Logging message"); - -var userName: string = auth.getCachedUser().userName;var postLogoutRedirectUrl = auth.config.postLogoutRedirectUri; -var isValidRequest = auth.getRequestInfo('hash').valid; \ No newline at end of file diff --git a/types/adal/tsconfig.json b/types/adal/tsconfig.json deleted file mode 100644 index a024918b3a..0000000000 --- a/types/adal/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "adal-angular.d.ts", - "test/index.ts", - "test/angular.ts" - ] -} \ No newline at end of file diff --git a/types/adal/tslint.json b/types/adal/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/adal/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -}