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

Ntrnl 499 extract user email from cola jwt #10

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

harley-harris
Copy link
Contributor

@harley-harris harley-harris commented Jul 1, 2024

JIRA link

NTRNL-499

Description

Extract userEmail from COLA JWT and attach to res.locals as userEmailAuth property. This makes the userEmail available for an application to use when using the COLA middleware.

This change was tested by locally installing this library into the GitHub Requests application and logging out the email in a controller:

// home.controller.ts

export const get = (req: Request, res: Response, next: NextFunction) => {
    try {
        const appData: ApplicationData = getSessionData(req.session);

        console.log('hello from home controller');
        console.log(res.locals.userEmailAuth);

        return res.render(config.HOME, {
            ...appData
        });
    } catch (err: any) {
        log.errorRequest(req, err.message);
        next(err);
    }
};

Work checklist

  • Tests added where applicable
  • No vulnerability added

@harley-harris harley-harris requested a review from a team July 1, 2024 10:25
@harley-harris harley-harris self-assigned this Jul 1, 2024
Copy link

github-actions bot commented Jul 1, 2024

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 100% 99/99
🟢 Branches 97.56% 40/41
🟢 Functions 100% 16/16
🟢 Lines 100% 84/84

Test suite run success

35 tests passing in 5 suites.

Report generated by 🧪jest coverage report action from d82d8a8

Copy link
Contributor

@Mouhajer-CO Mouhajer-CO left a comment

Choose a reason for hiding this comment

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

Awesome 🔥 and thanks for updating the sem version 🙏

@harley-harris harley-harris merged commit 899e25e into main Jul 1, 2024
7 checks passed
@harley-harris harley-harris deleted the NTRNL-499-extract-user-email-from-cola-jwt branch July 1, 2024 13:04
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.

2 participants