Bunped version of auth library + refactored some of OAuthApp object to be able to get access to lower objects (Client) if necessary
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 35s
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 35s
This commit is contained in:
parent
9a21ec9614
commit
0402b5297b
3 changed files with 17 additions and 10 deletions
|
|
@ -68,6 +68,8 @@ export class OAuthApp extends App {
|
|||
private auth_default_response_mode?: 'query' | 'fragment' | 'form_post';
|
||||
private client_secret?: string;
|
||||
|
||||
private client: Client;
|
||||
|
||||
/**
|
||||
* Create a new OAuth app
|
||||
*
|
||||
|
|
@ -132,6 +134,11 @@ export class OAuthApp extends App {
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the OAuthApp's Client instance (which is useful for managing keys, creating resource request, etc...) */
|
||||
getClient(): Client {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the OAuth client
|
||||
*
|
||||
|
|
@ -160,7 +167,7 @@ export class OAuthApp extends App {
|
|||
.getRouter()
|
||||
.addOutsideFrameworkRoute('/.well-known/jwks.json');
|
||||
|
||||
const client = await Client.setup<BridgemanAccessibleAppClaims>(
|
||||
this.client = await Client.setup<BridgemanAccessibleAppClaims>(
|
||||
app.getExpressApp(),
|
||||
baseAppUrl,
|
||||
this.onAuth,
|
||||
|
|
@ -185,7 +192,7 @@ export class OAuthApp extends App {
|
|||
}
|
||||
);
|
||||
|
||||
client.getSetupRoutes().forEach((route) => {
|
||||
this.client.getSetupRoutes().forEach((route) => {
|
||||
logMessage(`Adding outside framework route: ${route}`, LogLevel.DEBUG);
|
||||
app.getInitializer().getRouter().addOutsideFrameworkRoute(route);
|
||||
});
|
||||
|
|
@ -200,7 +207,7 @@ export class OAuthApp extends App {
|
|||
*
|
||||
* @param app The Express app object (that is now listening)
|
||||
*/
|
||||
async onStart(app: App, callback?: (app: App) => void | Promise<void>) {
|
||||
private async onStart(app: App, callback?: (app: OAuthApp) => void | Promise<void>) {
|
||||
try {
|
||||
// Setup the OAuth client.
|
||||
// This is done here because we need the client to be serving/listening for requests for the auth library stuff to work
|
||||
|
|
@ -208,7 +215,7 @@ export class OAuthApp extends App {
|
|||
await this.setupOAuthClient(app);
|
||||
|
||||
if(typeof callback !== 'undefined') {
|
||||
await callback.bind(this)(app);
|
||||
await callback(this);
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
|
|
@ -228,7 +235,7 @@ export class OAuthApp extends App {
|
|||
* And doesn't have to worry about the OAuth details to make this work.
|
||||
* Though it does provide tweaking the OAuth details via options provided to the constructor.
|
||||
*/
|
||||
async run<T extends Initializer>(initializer?: T, callback?: (app: App) => void | Promise<void>) {
|
||||
async run<T extends Initializer>(initializer?: T, callback?: (app: OAuthApp) => void | Promise<void>) {
|
||||
await super.run(initializer, async (app: App) => this.onStart(app, callback));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue