Skip to content

Conversation

@Rugvip
Copy link
Member

@Rugvip Rugvip commented Sep 3, 2020

Most of this is just renaming and moving, and removing a bunch of unused types.

One larger changes is that environments are now an OAuth thing, as in we don't assume that other providers support them. That way we could simplify the setup a bit and move the responsibility for setting up the different envs to the provider factory functions.

Docs are updated so they should reflect the changes too.

Also adds a 404 for when trying to use missing auth providers.

@Rugvip Rugvip requested a review from a team as a code owner September 3, 2020 13:21
Copy link
Member

@freben freben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Much clearer

clientID: options.clientId,
clientSecret: options.clientSecret,
callbackURL: options.callbackUrl,
passReqToCallback: false as true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS support in passport is not great ^_>. It's tricky to wrap it up more than this though, since providers are different. May be that we should just create our own type definitions, but then that would be part of adding providers too, which is a bit meh

logout?(): Promise<any>;
start(
req: express.Request,
options: Record<string, string>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just moved, so followup PR

!state.nonce ||
!state.env ||
state.nonce?.length === 0 ||
state.env?.length === 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either those question marks can be left out, or just check if (!state.nonce?.length ||...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this


const clientId = envConfig.getString('clientId');
const clientSecret = envConfig.getString('clientSecret');
const tenantID = envConfig.getString('tenantId');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

const providerId = 'gitlab';
const clientId = envConfig.getString('clientId');
const clientSecret = envConfig.getString('clientSecret');
const audience = envConfig.getString('audience');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

};

export type OAuthState = {
/* A type for the serialized value in the `state` parameter of the OAuth authorization flow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two asterisks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants