Skip to content

Commit

Permalink
feat(auth): using @xmlking/angular-oauth2-oidc-all
Browse files Browse the repository at this point in the history
using moded lib to support Auth Code Flow + PKCE and upgraded Angular CLI to 7.2.1
  • Loading branch information
xmlking committed Jan 10, 2019
1 parent 4f2d31b commit dd02035
Show file tree
Hide file tree
Showing 15 changed files with 259 additions and 518 deletions.
9 changes: 6 additions & 3 deletions PLAYBOOK.md
Expand Up @@ -164,7 +164,8 @@ npm i @angular/flex-layout
# Add in-memory-web-api
npm i angular-in-memory-web-api
# Add oauth2-oidc
npm i angular-oauth2-oidc
~~npm i angular-oauth2-oidc~~
npm i @xmlking/angular-oauth2-oidc-all

# Add NGXS
ng add @ngxs/schematics # makesure "defaultCollection" is set back to "@nrwl/schematics" in angular.json
Expand Down Expand Up @@ -415,7 +416,7 @@ ng g component components/sidenavItem --project=sidenav -d
ng g directive IconSidenav --project=sidenav -d

# generate components for `auth` Module
ng g lib auth --prefix=ngx --tags=private-module,core-module --prefix=ngx --style=scss --unit-test-runner=jest -d
ng g lib auth --tags=private-module,core-module --prefix=ngx --style=scss --unit-test-runner=jest -d
ng g component components/login --project=auth -d
ng g guard admin --project=auth -d
ng g @ngxs/schematics:store --name=auth --spec --project=auth -d
Expand Down Expand Up @@ -569,7 +570,9 @@ npx compodoc -s -d docs
```bash
# build for gh-pages
build:mock --base-href /ngx-starter-kit/
npm run build:mock
# maybe compress
gzip -k -r dist/apps/webapp/*.js
# push gh-pages
npx ngh --dir dist/apps/webapp
```
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/admin.guard.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { MatSnackBar } from '@angular/material';

@Injectable({
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/auth.guard.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { Store } from '@ngxs/store';
import { Login } from './auth.actions';
// import { waitUntil } from '@ngx-starter-kit/utils';
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/auth.module.ts
@@ -1,7 +1,7 @@
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { JwksValidationHandler, OAuthModule, OAuthService, ValidationHandler } from 'angular-oauth2-oidc';
import { JwksValidationHandler, OAuthModule, OAuthService, ValidationHandler } from '@xmlking/angular-oauth2-oidc-all';
import { Store } from '@ngxs/store';

import { initializeAuth } from './oauth.init';
Expand Down
4 changes: 2 additions & 2 deletions libs/auth/src/lib/auth.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable, Subscription, throwError } from 'rxjs';
import { catchError, filter, mergeMap, tap } from 'rxjs/operators';
Expand All @@ -11,7 +11,7 @@ import { MatDialog } from '@angular/material';
import { Router } from '@angular/router';
import { AuthState, AuthStateModel } from './auth.state';
import { fromPromise } from 'rxjs/internal/observable/fromPromise';
import { OAuthEvent } from 'angular-oauth2-oidc/events';
import { OAuthEvent } from '@xmlking/angular-oauth2-oidc-all/events';

@Injectable()
export class AuthService {
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/auth.state.ts
Expand Up @@ -13,7 +13,7 @@ import {
import { AuthService } from './auth.service';
import { Router } from '@angular/router';
import { authConfigImplicit, authConfigPassword } from './oauth.config';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { map } from 'rxjs/operators';

export interface AuthStateModel {
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/components/login/login.component.ts
Expand Up @@ -4,7 +4,7 @@ import { ROPCService } from '../../ropc.service';
import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { HttpErrorResponse } from '@angular/common/http';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { Store } from '@ngxs/store';
import { ChangeAuthMode, AuthMode } from '../../auth.actions';

Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/oauth.config.ts
@@ -1,4 +1,4 @@
import { AuthConfig } from 'angular-oauth2-oidc';
import { AuthConfig } from '@xmlking/angular-oauth2-oidc-all';
import { environment } from '@env/environment';

const base = document.querySelector('base');
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/oauth.init.ts
@@ -1,4 +1,4 @@
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { Store } from '@ngxs/store';
import { LoginSuccess } from './auth.actions';
import { AuthorizationErrorResponse } from './oauth.errors';
Expand Down
2 changes: 1 addition & 1 deletion libs/auth/src/lib/ropc.service.ts
@@ -1,5 +1,5 @@
import { Inject, Injectable } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from '@env/environment';

Expand Down
2 changes: 1 addition & 1 deletion libs/core/src/lib/interceptors/jwt.interceptor.ts
Expand Up @@ -3,7 +3,7 @@ import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/c
import { Observable } from 'rxjs';
import { Store } from '@ngxs/store';
import { environment } from '@env/environment';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';

const allowedUrls = [environment.API_BASE_URL, environment.DOCS_BASE_URL];

Expand Down
Expand Up @@ -5,7 +5,7 @@ import { NavigationEnd, Router } from '@angular/router';
import { routeAnimation, hierarchicalRouteAnimation } from '@ngx-starter-kit/animations';
import { Actions, Store } from '@ngxs/store';
import { ConnectWebSocket, DisconnectWebSocket } from '@ngx-starter-kit/socketio-plugin';
import { OAuthService } from 'angular-oauth2-oidc';
import { OAuthService } from '@xmlking/angular-oauth2-oidc-all';
import { environment } from '@env/environment';
import { RouterState } from '@ngxs/router-plugin';
import { map } from 'rxjs/operators';
Expand Down

0 comments on commit dd02035

Please sign in to comment.