@memberjunction/ng-auth-services 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { MsalRedirectComponent } from '@azure/msal-angular';
3
+ import * as i0 from "@angular/core";
4
+ type AuthEnvironment = {
5
+ AUTH_TYPE: string;
6
+ CLIENT_ID: string;
7
+ CLIENT_AUTHORITY: string;
8
+ AUTH0_CLIENTID: string;
9
+ AUTH0_DOMAIN: string;
10
+ };
11
+ export declare const RedirectComponent: typeof MsalRedirectComponent;
12
+ export declare class AuthServicesModule {
13
+ static forRoot(environment: AuthEnvironment): ModuleWithProviders<AuthServicesModule>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthServicesModule, never>;
15
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AuthServicesModule, never, never, never>;
16
+ static ɵinj: i0.ɵɵInjectorDeclaration<AuthServicesModule>;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=auth-services.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-services.module.d.ts","sourceRoot":"","sources":["../../src/lib/auth-services.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAuB9D,OAAO,EAML,qBAAqB,EAEtB,MAAM,qBAAqB,CAAC;;AAG7B,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,8BAAwB,CAAC;AAEvD,qBACa,kBAAkB;IAC7B,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;yCAD1E,kBAAkB;0CAAlB,kBAAkB;0CAAlB,kBAAkB;CAiE9B"}
@@ -0,0 +1,88 @@
1
+ import { NgModule } from '@angular/core';
2
+ // Local Components
3
+ import { MJAuthBase } from './mjexplorer-auth-base.service';
4
+ import { MJAuth0Provider } from './mjexplorer-auth0-provider.service';
5
+ import { MJMSALProvider } from './mjexplorer-msal-provider.service';
6
+ //***********************************************************
7
+ // Auth0
8
+ //***********************************************************
9
+ import { Auth0ClientFactory, Auth0ClientService, AuthClientConfig, AuthConfigService, AuthGuard, AuthService, } from '@auth0/auth0-angular';
10
+ //***********************************************************
11
+ //MSAL
12
+ //***********************************************************
13
+ import { MSAL_GUARD_CONFIG, MSAL_INSTANCE, MSAL_INTERCEPTOR_CONFIG, MsalBroadcastService, MsalGuard, MsalRedirectComponent, MsalService, } from '@azure/msal-angular';
14
+ import { InteractionType, PublicClientApplication } from '@azure/msal-browser';
15
+ import * as i0 from "@angular/core";
16
+ export const RedirectComponent = MsalRedirectComponent;
17
+ export class AuthServicesModule {
18
+ static forRoot(environment) {
19
+ return {
20
+ ngModule: AuthServicesModule,
21
+ providers: [
22
+ environment.AUTH_TYPE === 'auth0'
23
+ ? [
24
+ AuthService,
25
+ AuthGuard,
26
+ {
27
+ provide: AuthConfigService,
28
+ useValue: {
29
+ domain: environment.AUTH0_DOMAIN,
30
+ clientId: environment.AUTH0_CLIENTID,
31
+ authorizationParams: {
32
+ redirect_uri: window.location.origin,
33
+ },
34
+ cacheLocation: 'localstorage',
35
+ },
36
+ },
37
+ {
38
+ provide: Auth0ClientService,
39
+ useFactory: Auth0ClientFactory.createClient,
40
+ deps: [AuthClientConfig],
41
+ },
42
+ ]
43
+ : [
44
+ {
45
+ provide: MSAL_INSTANCE,
46
+ useValue: new PublicClientApplication({
47
+ auth: {
48
+ clientId: environment.CLIENT_ID,
49
+ authority: environment.CLIENT_AUTHORITY,
50
+ redirectUri: window.location.origin,
51
+ },
52
+ cache: {
53
+ cacheLocation: 'localStorage',
54
+ storeAuthStateInCookie: false, // Could move this to environment config - set to true for Internet Explorer 11
55
+ },
56
+ }),
57
+ },
58
+ {
59
+ provide: MSAL_GUARD_CONFIG,
60
+ useValue: {
61
+ interactionType: InteractionType.Redirect, // MSAL Guard Configuration
62
+ authRequest: {
63
+ scopes: ['User.Read'],
64
+ },
65
+ },
66
+ },
67
+ {
68
+ provide: MSAL_INTERCEPTOR_CONFIG,
69
+ useValue: {
70
+ interactionType: InteractionType.Redirect, // MSAL Interceptor Configuration
71
+ protectedResourceMap: new Map([['https://graph.microsoft.com/v1.0/me', ['user.read']]]),
72
+ },
73
+ },
74
+ MsalService,
75
+ MsalGuard,
76
+ MsalBroadcastService,
77
+ ],
78
+ { provide: MJAuthBase, useClass: environment.AUTH_TYPE === 'auth0' ? MJAuth0Provider : MJMSALProvider },
79
+ ],
80
+ };
81
+ }
82
+ }
83
+ AuthServicesModule.ɵfac = function AuthServicesModule_Factory(t) { return new (t || AuthServicesModule)(); };
84
+ AuthServicesModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AuthServicesModule });
85
+ AuthServicesModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
86
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthServicesModule, [{
87
+ type: NgModule
88
+ }], null, null); })();
@@ -1,4 +1,5 @@
1
1
  export * from './lib/mjexplorer-auth-base.service';
2
2
  export * from './lib/mjexplorer-auth0-provider.service';
3
3
  export * from './lib/mjexplorer-msal-provider.service';
4
+ export * from './lib/auth-services.module';
4
5
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC"}
@@ -4,3 +4,4 @@
4
4
  export * from './lib/mjexplorer-auth-base.service';
5
5
  export * from './lib/mjexplorer-auth0-provider.service';
6
6
  export * from './lib/mjexplorer-msal-provider.service';
7
+ export * from './lib/auth-services.module';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-auth-services",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "MemberJunction Explorer: Authentication Services",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -27,7 +27,7 @@
27
27
  "@azure/msal-angular": "^3.0.11"
28
28
  },
29
29
  "dependencies": {
30
- "@memberjunction/core": "~1.2.2",
30
+ "@memberjunction/core": "~1.3.0",
31
31
  "tslib": "^2.3.0"
32
32
  },
33
33
  "sideEffects": false