Skip to content

Commit

Permalink
Re-implemented authentication with generalized auth implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Proantagonist committed May 13, 2021
1 parent 2b92d9a commit 87bc57a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
13 changes: 5 additions & 8 deletions apps/ues-recycling-angular/src/app/app.module.ts
@@ -1,11 +1,11 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';

import * as WebFont from 'webfontloader';
import { env, EnvironmentService } from '@tamu-gisc/common/ngx/environment';
import { AuthInterceptor } from '@tamu-gisc/geoservices/data-access';
import { AuthGuard, AuthProvider } from '@tamu-gisc/common/ngx/auth';

import * as environment from '../environments/environment';
import { AppComponent } from './app.component';
Expand All @@ -29,7 +29,8 @@ WebFont.load({
[
{
path: 'data',
loadChildren: () => import('@tamu-gisc/ues/recycling/ngx').then((m) => m.DataModule)
loadChildren: () => import('@tamu-gisc/ues/recycling/ngx').then((m) => m.DataModule),
canActivate: [AuthGuard]
},
{
path: '',
Expand All @@ -45,11 +46,7 @@ WebFont.load({
provide: env,
useValue: environment
},
{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptor,
multi: true
}
AuthProvider
],
bootstrap: [AppComponent]
})
Expand Down
Expand Up @@ -8,6 +8,6 @@ export * from './definitions';

export const apiUrl = 'https://nodes.geoservices.tamu.edu/api/ues/recycling/';
export const auth_options: AuthOptions = {
url: `https://nodes.geoservices.tamu.edu/api/ues/recycling/`,
url: `https://nodes.geoservices.tamu.edu/api/ues/recycling`,
attach_href: true
};
2 changes: 1 addition & 1 deletion apps/ues-recycling-angular/src/environments/environment.ts
Expand Up @@ -18,4 +18,4 @@ import 'zone.js/dist/zone-error'; // Included with Angular CLI.
export * from './definitions';

export const apiUrl = 'http://localhost:3333/api/';
export const auth_api_url = 'http://localhost:3333/api/';
export const auth_url = 'http://localhost:3333/api';
5 changes: 4 additions & 1 deletion libs/common/ngx/auth/src/lib/services/auth.service.ts
Expand Up @@ -10,7 +10,10 @@ import { EnvironmentService } from '@tamu-gisc/common/ngx/environment';
providedIn: 'root'
})
export class AuthService {
public authOptions: AuthOptions;
public authOptions: AuthOptions = {
url: undefined,
attach_href: undefined
};

constructor(private http: HttpClient, private env: EnvironmentService) {
if (this.env.value('auth_url', true)) {
Expand Down

0 comments on commit 87bc57a

Please sign in to comment.