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

feat: activate identity provider on specific url path #1484

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Eisie96
Copy link
Contributor

@Eisie96 Eisie96 commented Aug 17, 2023

PR Type

[ ] Bugfix
[ x ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] CI-related changes
[ ] Documentation content changes
[ ] Application / infrastructure changes
[ ] Other:

What Is the Current Behavior?

Currently the PWA can only be setup with one active identity provider. The PWA should be configured for specific identity providers in such a way, that these are active, when the PWA is rendered with a specific url path. The punchout identity provider should be used, when the 'punchout' feature is active and the PWA is initially loaded with /punchout.

Issue Number: Closes #

What Is the New Behavior?

The activeOnPath property is introduced for the IdentityProviderImplementor interface. When the current url path matches the configured value, then the new identity provider is used. If no url path has a match with the available identity providers, then the old behavior is used.

Furthermore all identity provider guards and interceptors are adapted to wait until a active identity provider is found.

Does this PR Introduce a Breaking Change?

[ ] Yes
[ x ] No

Other Information

AB#88708

@Eisie96 Eisie96 changed the title Feat/activate idp route feat: activate identity provider on specific url path Aug 17, 2023
@Eisie96 Eisie96 self-assigned this Aug 21, 2023
@kepek
Copy link
Contributor

kepek commented Aug 24, 2023

🥇

@SGrueber SGrueber self-requested a review August 28, 2023 12:14
@stxppxr stxppxr added this to the 4.2 milestone Aug 30, 2023
Copy link
Collaborator

@SGrueber SGrueber left a comment

Choose a reason for hiding this comment

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

Please add some documentation to the authentication concept as well as to the punchout guide, and write a short migration note.

@SGrueber SGrueber added enhancement Enhancement to an existing feature refactoring Refactoring of current code labels Aug 31, 2023
@Eisie96 Eisie96 force-pushed the feat/activate-idp-route branch from 6f912a4 to 7af2cc8 Compare September 5, 2023 14:07
@Eisie96 Eisie96 requested a review from SGrueber September 5, 2023 14:07
docs/concepts/authentication.md Outdated Show resolved Hide resolved
docs/concepts/authentication.md Outdated Show resolved Hide resolved
docs/concepts/authentication.md Outdated Show resolved Hide resolved
docs/concepts/authentication.md Outdated Show resolved Hide resolved
return this.identityProviderFactory.getInstance()?.intercept(req, next) ?? next.handle(req);
return this.identityProviderFactory.initialized$.pipe(
whenTruthy(),
first(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

first or better take(1) ?

src/app/core/utils/functions.ts Outdated Show resolved Hide resolved
@shauke shauke modified the milestones: 4.2, 5.0 Sep 8, 2023
@Eisie96 Eisie96 force-pushed the feat/activate-idp-route branch from 7af2cc8 to 2077971 Compare October 19, 2023 14:10
@Eisie96 Eisie96 requested a review from SGrueber October 20, 2023 08:44
@SGrueber
Copy link
Collaborator

There is still a problem:

  1. Login as punchout user, e.g. localhost:4201/punchout?USERNAME=[email protected]&PASSWORD=!InterShop00!&HOOK_URL=https://punchoutcommerce.com/tools/oci-roundtrip-return
  2. Logout
  3. Go to Login Page
  4. An error page occurs:

image

Copy link
Collaborator

@SGrueber SGrueber left a comment

Choose a reason for hiding this comment

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

Entering the login page after logout of the punchout user leads to an error page (see conversation page)

@@ -94,7 +94,7 @@ With the ICM identity provider, for example, the user is then automatically logg

## Activate Identity Provider on specific paths

For specific use cases the PWA have to activate the identity provider for specific pwa url paths.
In future the PWA will have more cases which needs to activate the identity provider for specific pwa url paths.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is possible to activate the identity provider for specific pwa url paths, e.g.

@@ -115,7 +115,7 @@ The behavior can be configured primarily by adding `activeOnPath` property for t

This configuration would activate the specific identity provider, when the PWA initially routes to a specific url.

An another possibility is to use the `OVERRIDE_IDENTITY_PROVIDERS` environment variable within the nginx deployment.
Another possibility or the identity provider activation could be the usage of the `OVERRIDE_IDENTITY_PROVIDERS` environment variable within the nginx deployment.
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you mean: Another possibility of the identity provider ... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes ;)

@Eisie96
Copy link
Contributor Author

Eisie96 commented Oct 24, 2023

There is still a problem:

  1. Login as punchout user, e.g. localhost:4201/punchout?USERNAME=[email protected]&PASSWORD=!InterShop00!&HOOK_URL=https://punchoutcommerce.com/tools/oci-roundtrip-return
  2. Logout
  3. Go to Login Page
  4. An error page occurs:

image

This is a known issue in Development and has nothing to do with the PR. The punchout idp is configured to be active, when the /punchout route is used during the PWA initialization. The identity provider expects, that the punchout route has certain login parameter. Within the PWA it is configured, that the /punchout route redirects to the /login route in order to use the triggerLogin() function.

In the use case it is described, that the user enters the /login page after successful logout. During the runtime of the PWA the punchout identity provider is still active. That's why the idp expects, that the /login route contains necessary parameter to login the punchout user.

@SGrueber SGrueber force-pushed the feat/activate-idp-route branch from a47b14d to 2daa5af Compare December 12, 2023 11:52
@shauke shauke assigned shauke and unassigned Eisie96 Dec 13, 2023
@SGrueber SGrueber force-pushed the feat/activate-idp-route branch from 2daa5af to 9ed88f7 Compare December 20, 2023 13:22
…ate, introduce public api to access initialized$ subject values from outside, move getTriggerReturnType function to functions.ts
@SGrueber SGrueber force-pushed the feat/activate-idp-route branch from 9ed88f7 to 043a871 Compare December 20, 2023 13:24
@SGrueber SGrueber modified the milestones: 5.0, 5.1 Dec 21, 2023
@shauke shauke modified the milestones: 5.1, 5.2 Mar 22, 2024
@shauke shauke removed this from the 5.2 milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature has conflicts refactoring Refactoring of current code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants