Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update seeding to delete itself on re-run + misc #45

Merged
merged 4 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 26 additions & 24 deletions api/src/security/auth-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,31 @@ export const authenticate = async function (req: any, scopes: string[]): Promise
* @returns {*} verifiedToken
*/
const verifyToken = function (tokenString: any, secretOrPublicKey: any): any {
return verify(tokenString, secretOrPublicKey, { ignoreExpiration: TOKEN_IGNORE_EXPIRATION }, function (
verificationError: any,
verifiedToken: any
): any {
if (verificationError) {
defaultLog.warn({ label: 'verifyToken', message: 'jwt verification error', verificationError });
return null;
return verify(
Copy link
Collaborator Author

@NickPhura NickPhura Feb 2, 2021

Choose a reason for hiding this comment

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

This entire file has no real code changes, this is just running the formatter.

tokenString,
secretOrPublicKey,
{ ignoreExpiration: TOKEN_IGNORE_EXPIRATION },
function (verificationError: any, verifiedToken: any): any {
if (verificationError) {
defaultLog.warn({ label: 'verifyToken', message: 'jwt verification error', verificationError });
return null;
}

// Verify that the token came from the expected issuer
// Example: when running in prod, only accept tokens from `sso.pathfinder...` and not `sso-dev.pathfinder...`, etc
if (!KEYCLOAK_URL.includes(verifiedToken.iss)) {
defaultLog.warn({
label: 'verifyToken',
message: 'jwt verification error: issuer mismatch',
'found token issuer': verifiedToken.iss,
'expected to be a substring of': KEYCLOAK_URL
});
return null;
}

defaultLog.debug({ label: 'verifyToken', message: 'jwt verification success' });

return verifiedToken;
}

// Verify that the token came from the expected issuer
// Example: when running in prod, only accept tokens from `sso.pathfinder...` and not `sso-dev.pathfinder...`, etc
if (!KEYCLOAK_URL.includes(verifiedToken.iss)) {
defaultLog.warn({
label: 'verifyToken',
message: 'jwt verification error: issuer mismatch',
'found token issuer': verifiedToken.iss,
'expected to be a substring of': KEYCLOAK_URL
});
return null;
}

defaultLog.debug({ label: 'verifyToken', message: 'jwt verification success' });

return verifiedToken;
});
);
};
Loading