-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support SSO authentication #142
Comments
Hi @davidgeiger, this would be a big change, as the authentication would then have to be stored in an external token, which is a completely different concept than how it is done now. And the CLI currently uses two users. So the default user (Org-Admin) and if specified an admin account (e.g. service account) which performs all the tasks the default user can't do. The admin account is then stored in the pipeline if necessary. I am not sure how this can be brought together with the SSO concept. Any thoughts? |
@cwiechmann Maybe a simpler alternative (or intermediary) way to see this would be to allow decoupling the login part by providing the session cookie in an environment variable. Just my 2 cents here |
this. pls. but it can tricky, as org IDP might be enforcing browsers.. we can't issue local accounts to users. but something. pls. |
I think the CLI must support a command like: Ultimately the generated Session-ID returned by the API-Manager will be stored in a local config file, no matter which authentication option was used. @emmanuel-galindo, can you please elaborate a bit more on this example? |
Sounds good to me. I believe both of the above examples (Amplify and gcloud CLI) open a browser window for an interactive OAuth auth code flow. I assume a similar approach could be used to open a browser window for authentication with API Manager's SSO endpoint via a SAML flow. The resulting user authentication token would be a generated session cookie instead of an OAuth JWT. |
opening a browser to get the token seems a good to me, and if you have already done for amplify-cli maybe it will avaialble soon? @cwiechmann in ocp webadmin, you have a way to copy to your clipboard a string similar to: |
@cwiechmann any update on this feature? or is there any plan to include some alternative to having to login with a non-sso api admin in the next releases? |
@cwiechmann I just got to "2.2 Create a service account using the Amplify Central UI |
Same here, this would be an important feature to reduce the number of password-based "service accounts". They may still be required for technical clients that cannot obtain a SAML token, but anyone else - in particular the average org admin - should be able to use the CLI with their SSO identity. @cwiechmann: Have you considered integrating the API Mgr CLI functionality into the Axway CLI given that it already supports interactive authentication? This would also reduce the number of CLIs that a user has to install. ;) Not sure if there is an efficient way to port or emulate the Java-based codebase. |
Unfortunately there was no time at all to work in this. As you may guess it's a major undertaking to implement this. |
Haven't thought this through, but perhaps it is feasible to create a simple wrapper around the apim-cli in order to turn it into an Axway CLI extension? A command such as "axway apimgr import" would then trigger the apim-cli (JRE) execution. This could also be helpful. Assuming that the available (interactive) authentication framework could be adjusted to interact with API Manager, it could pass the obtained SAML assertion as a parameter to the apim-cli. Leveraging the package manager for apim-cli installation also seems interesting. |
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
Any new thoughts on how to approach this? I believe an interactive authentication is crucial to ensure CLI usability with an SSO-enabled distributed setup. Having to request dedicated technical users (with passwords) for each use case introduces security risks and a significant adoption barrier. |
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
Would it help to engage with the Axway CLI team to see if the same logic can be used? The need to create a technical username/password account for each user who wants to use the CLI creates a lot of overhead. |
@davidgeiger is there any way to login to the API manager API (port 8075) by not using username/password? https://apidocs.axway.com/swagger-ui-NEW/index.html?productname=apimanager&productversion=7.7.0&filename=api-manager-V_1_4-oas3.json#/Login/login seems to accept only login and password parameters and sets some cookies to let the API client work. |
@saper and @davidgeiger, One option i think of doing IDP initiated SSO - In that case APIM CLI will act as IDP, it accepts username, generate SAML token, sign it and send it API manager to generate user session. The session will be used by APIM CLI to make subsequent API call to API manager. What do you think about it? |
Hi @rathnapandi. I might have misunderstood but this doesn't seem feasible to me. A user's identity needs to be authenticated by the central identity provider. Otherwise, users can easily impersonate each other. I believe the approach that was outlined in the previous discussion is a best practice for CLIs (incl. the axway cli): In addition to the existing password-based authentication, offer an interactive SSO option. This opens the API Manager SSO login in a browser window, which will trigger the SAML authentication flow with the IdP via redirects and result in an API Manager session. At this point the browser window can be closed and the session id can be used for all subsequent API calls (@saper). Implementation is mainly a matter of orchestration since this approach leverages the existing API Manager SSO mechanism and session authentication. As an alternative, it may be worth looking into leveraging the existing axway cli or its authentication framework (as suggested before). I want to stress the importance of supporting SSO authentication in the CLI again. At this point the average API Manager user can not use the CLI with an SSO-integrated API Manager instance. Every CLI user needs a password-based account, which would negate the benefits of an SSO integration. |
Hi @davidgeiger, I agree with your concerns. During SSO, API manager generates cookie and CSRF token after successful login and assign roles based on the service-proivder.xml configuration. The cookie and CSRF token can be used for REST API call. Challenge is how do we know the authentication is complete and how can we read the cookies from browser? Amplify CLI uses following process during authentication. The CLI uses Oauth2 OIDC.
Amplify platform acting as IDP if Amplify tenant is not configured with SSO, if the tenant is configured with SSO, it will act as IDP broker. I am thinking of a hybrid approach.
Challenge : To overcome the above challenge, we can configure additional profile on service-provider.xml and manage our own private key or ignore the signing validation. |
Hi @rathnapandi. I see several challenges with the described hybrid approach. It will not be possible to use private keys of our IdP. More generally, if the CLI issues or signs the SAML assertions, this would require the gateway to trust all CLI instances (run by any user), which is not feasible (risk of impersonation). Couple of thoughts on other SAML options (although I am not terribly familiar with the protocol):
As an alternative to SAML, the CLI could use OIDC exclusively to authenticate with API Manager. This would be largely the same flow as with the Amplify CLI. It would require the configuration of account authentication+information policies in API Manager whose behavior is in line with the SAML SSO configuration (extracting and mapping the same information from the tokens). I understand there have already been some activities to also enable OIDC as a general SSO option besides SAML, so there might be some synergies. The only reason that we went with SAML so far was really the lack of support for OIDC in the UI (redirect flows etc.) - which wouldn't be an issue with the CLI. |
Thanks @davidgeiger for your suggestion and validation. Why do you think it is risk of impersonation? CLI is going to do token mediation (OIDC to SAML). the user will be validated with IDP via OIDC flow. As i mentioned earlier, we can create a second IDP provider configuration by disabling SAML signature verification and encryption. SAML uses redirect URI aka relaystate from idp metadata configuration file. Hence we can't change the redirect URL on API gateway side. API manager supports two IDP providers. A combination of the first and second options might work. We create two SAML applications on IDP. one points to API manger another one points to APIM CLI by changing relaystate to localhost on IDP and configure second IDP provider on API manger via service-provider.xml.
I need to check with R&D on the timeline of APIM OIDC support. |
Re impersonation: If the CLI generates its own SAML assertions that are trusted by API Manager (signed or not), what prevents a user from changing the username in those assertions (e.g., by changing the CLI code)? I did some more digging into implementing the Amplify CLI behavior with SAML and still think this should be possible.
Alternatively, using OIDC instead should already be possible today. It merely requires a client that orchestrates the login flow, which essentially means redirecting unauthenticated users to the IdP where they authenticate and are redirected back to API Manager. IMHO this orchestration is the only part missing in API Manager to support OIDC SSO, but it is not relevant here since the CLI would handle the orchestration. Everything else is already supported and we are doing this in other places:
Finally, using either approach, I am wondering if there isn't an easier way for the CLI process to access the response data from the browser that it launches, i.e., without having to redirect it to a localhost HTTP port first? To illustrate what I mean: If we were to send an authentication request to the IdP using curl (which would be a bit cumbersome), we would get the authentication response directly as a command output. Are we sure this doesn't work with a graphical browser? |
Agreed, an SP-initiated login with authentication requests generated by the CLI will not work if the IdP expects signed requests. Signing requests does not seem to add any value in this case, however, since the actual user authentication happens at the IdP. If that is a concern, handling CLI authentication via a second IdP application without request signatures may be a possibility (if the resulting assertions are accepted by API Manager - see above). When using an SP-initiated login, the relevant parameter for passing a dynamic redirect URL is the AssertionConsumerServiceURL that can be added to the authentication request (Azure AD docs). AFAIK the RelayState can be used for a similar purpose in IdP-initiated logins but requires some logic on the SP side: The IdP still sends the authentication response to the configured (in this case static) ACS URL and simply passes the RelayState as an additional parameter. I don't think this helps here. Re the last point: I am not suggesting to use curl to handle the user login. I was merely wondering if there might be a more direct way to read the SAML assertion or access token from the IdP response of a browser window - besides redirecting the IdP response to a localhost port? Since the CLI launches the browser window, it may be able to get the HTTP response values through another means (comparable to the verbose output of a curl command). |
Once we launch browser window, we will lose control of request and responses unless we are acting as http proxy to intercept request and response. |
Ok. Either way, the approach with a redirect to localhost may work with both options. Any preferences or further relevant points on your end?
|
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last month and a half. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions. |
This continues being very relevant for a full SSO experience with API Manager. Please reopen. |
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
unstale |
will this be completed? or at least some alternative (ie tokens issues from api manager) it seems the only way is to build an api on top of all these to obscure these admin accounts, but yet provide tools for developers. It is a bit of an overhead. |
Hi @emmanuel-galindo, A workaround is CLI can initiate the SSO to IDP by sending SAML sign in request and get the SAML response from IDP, then CLI sends to API manager to get a session token. This approach requires additional configuration on IDP as well as API manager. |
User story
As a CLI user, I want to authenticate with API Manager using the configured SSO mechanism.
Additional context
When (SAML-based) SSO is used to log into API Manager, regular users do not have a username and password. In order to use the CLI, everyone needs to create a technical user (~ service account), which is not scalable and potentially insecure, especially if password are stored locally. Ideally, the APIM CLI would support an (interactive?) login with API Manager using the configured SSO mechanism. Similar mechanisms are supported, for instance, by the Amplify Central CLI and the gcloud CLI.
The text was updated successfully, but these errors were encountered: