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

Improve Modern Authentication edge case experiences regarding refresh token or misconfiguration #174

Closed
9 tasks done
ddemeyer opened this issue Oct 19, 2023 · 0 comments · Fixed by #181
Closed
9 tasks done
Assignees
Milestone

Comments

@ddemeyer
Copy link
Contributor

ddemeyer commented Oct 19, 2023

Where #152 introduced -Protocol offering Modern Authentication (OpenID Connect next to existing WS-Federation/WS-Trust) implementation on .NET 4.8 (Windows PowerShell 5.1) and .NET6+ (PowerShell 7.3+) along the happy path.

This issue tries to validate edge cases of misconfiguration up till token refresh.

  • Authentication over System Browser, so Authorization Code Flow with Proof Key for Code Exchange (PKCE), will give you 60 seconds. Any slower and you will see the New-IShSession/Test-IShSession cmdlets respond with TaskCanceledException exception stating Browser login canceled after 60 seconds.
  • Authentication over Client Credentials Flow with non-existing -ClientId will error out with GetTokensOverClientCredentialsAsync Access Error[invalid_client]; either invalid ClientId/ClientSecret combination or expired ClientSecret.. Please make sure you activate a client/secret on your Access Management User Profile (ISHAM).
  • Authentication over Client Credentials Flow with expired -ClientId/-ClientSecret combination will error out with GetTokensOverClientCredentialsAsync Access Error[invalid_client]; either invalid ClientId/ClientSecret combination or expired ClientSecret.. Please recycle expired client/secret on your Access Management User Profile (ISHAM).
  • Authentication over Client Credentials Flow with valid -ClientId/-ClientSecret combination, but not mapped in the CMS to a User Profile over FISHEXTERNALID will [-14] The access is denied because no profile match was found. 0. Please make sure that the client (which you can find on the Access Management User Profile) is added in Organize Space on one CMS User Profile in the comma-seperated External Id field.
  • Authentication over Client Credentials Flow with valid -ClientId/-ClientSecret combination, and mapped in the CMS to a User Profile over FISHEXTERNALID which is disabled will error out with [-6] Your account has been disabled. Please see your system administrator.. Please make sure in Organize Space that the one CMS User Profile holding the client in the External Id field is an enabled profile.
  • Authentication over either Client Credentials or System Browser was succesful but the Access Token expired. You do not need to create a New-IShSession, every cmdlet will attempt to get a token (either refresh or re-logon if required) based on the cmdlets (implicit) -IShSession parameter.
  • Using New-IshSession parameter -PSCredential on 14SP4/14.0.4 or earlier works like before, as it means username/password authentication over protocol WcfSoapWithWsTrust. However, using -PSCredential on 15/15.0.0 means that you are using protocol WcfSoapOverOpenIdConnect, so expecting a client/secret. If you then provide username/password, you will get error GetTokensOverClientCredentialsAsync Access Error[invalid_client]. Note that you can force by adding -Protocol WcfSoapWithWsTrust to the New-IshSession cmdlet.
  • Be consistent in the usage of AccessToken and BearerToken, prefer AccessToken as much as possible
  • Get-Help updates required for example... $ishSessionA = New-IshSession -WsBaseUrl "https://example.com/ISHWSPROD/" -PSCredential "Admin" --> -PSCredential Admin only works for -Protocol WcfSoapWithWsTrust so it is an outdated sample ... all New-IshSession should be reviewed.
@ddemeyer ddemeyer self-assigned this Oct 19, 2023
@ddemeyer ddemeyer added this to the v8.0 milestone Oct 19, 2023
ddemeyer pushed a commit that referenced this issue Nov 14, 2023
…enIdConnect protocol... Next are more manual tests to document known issues; New-IShSession Pester tests and perhaps add/test over OpenApiAM10Service... Much later deep dive into folder or project cmdlets based on OpenApi
ddemeyer pushed a commit that referenced this issue Jan 18, 2024
…enIdConnect protocol... New-IShSession Pester tests... Much later deep dive into folder or project cmdlets based on OpenApi
ddemeyer pushed a commit that referenced this issue Jan 18, 2024
…enIdConnect protocol... Finishing touchups on this feature... Much later deep dive into folder or project cmdlets based on OpenApi
@ddemeyer ddemeyer linked a pull request Jan 18, 2024 that will close this issue
ddemeyer added a commit that referenced this issue Jan 18, 2024
* Implemented support for getting a refresh token before token expires and retrieving a new access token after expiration.

* #174 Add refresh token for WcfSoapWithOpenIdConnect and OpenApiWithOpenIdConnect protocol... Next are more manual tests to document known issues; New-IShSession Pester tests and perhaps add/test over OpenApiAM10Service... Much later deep dive into folder or project cmdlets based on OpenApi

* #174 Add refresh token for WcfSoapWithOpenIdConnect and OpenApiWithOpenIdConnect protocol... New-IShSession Pester tests... Much later deep dive into folder or project cmdlets based on OpenApi

* #174 Add refresh token for WcfSoapWithOpenIdConnect and OpenApiWithOpenIdConnect protocol... Finishing touchups on this feature... Much later deep dive into folder or project cmdlets based on OpenApi

---------

Co-authored-by: Ivo van de Lagemaat <ivandelagemaat@sdl.com>
Co-authored-by: ddemeyer <ddemeyer@rws.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant