Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #74 from StephenCoady/add-config-method
Browse files Browse the repository at this point in the history
added config method to auth
  • Loading branch information
wtrocki authored May 4, 2018
2 parents 0e5085e + 2bb88c7 commit 905539f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/auth/src/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ export class AuthService {
public static readonly TYPE: string = "keycloak";

private auth: KeycloakInstance;
private internalConfig: any;

constructor(appConfig: AeroGearConfiguration) {
const configuration = new ConfigurationHelper(appConfig).getConfigByType(AuthService.TYPE);
let internalConfig;

if (!configuration || configuration.length === 0) {
console.warn("Keycloak configuration is missing. Authentication will not work properly.");
internalConfig = {};
this.internalConfig = {};
} else {
internalConfig = configuration[0].config;
this.internalConfig = configuration[0].config;
}

this.auth = Keycloak(internalConfig);
this.auth = Keycloak(this.internalConfig);
}

/**
Expand Down Expand Up @@ -98,4 +98,10 @@ export class AuthService {
}
return [];
}
/**
* Return the config used for the auth service
*/
public getConfig(): string[] {
return this.internalConfig;
}
}

0 comments on commit 905539f

Please sign in to comment.