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

fix: user profile to principal #3807

Merged
merged 1 commit into from
Sep 26, 2019
Merged

fix: user profile to principal #3807

merged 1 commit into from
Sep 26, 2019

Conversation

jannyHou
Copy link
Contributor

Fixes #3766 and #3707

Since PR #3796 is created earlier I would like to respect @derdeka 's contribution, feel free to take code from this PR to save your time on adding tests/code refactor.

My only concern for #3796 is explained in comment, after fixing it we can land it, then see if my PR still needed(improve #3796 or close it).

import {Principal, securityId, UserProfile} from '@loopback/security';

// This is a workaround before we specify `TypedPrincipal` instead of
// `Principal` for the principals in the authorization context.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change will be addressed as part of #2246 or as a follow-up story after the spike done.

@jannyHou jannyHou marked this pull request as ready for review September 26, 2019 14:40
* user profile
* @param user The user profile passed from `@loopback/authentication`.
*/
export function userProfileToPrincipalBuilder(user: UserProfile): Principal {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe name it as createPrincipalFromUserProfile?

@jannyHou jannyHou force-pushed the update/authorize branch 2 times, most recently from c801f0f to 5ff27b6 Compare September 26, 2019 20:10
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.

authorization: workaround userToPrinciple replaces expected securityId
2 participants