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

Enable APIML token renewal before expiration #1966

Open
gejohnston opened this issue Nov 15, 2023 · 6 comments
Open

Enable APIML token renewal before expiration #1966

gejohnston opened this issue Nov 15, 2023 · 6 comments
Labels
enhancement New feature or request keep Issues with this label will be ignored by the stale bot priority-low Legit issue but cosmetic or nice-to-have

Comments

@gejohnston
Copy link
Member

Is your feature or enhancement request related to a problem or limitation? Please describe

When an APIML token expires, a REST request fails and the user is directed to login again.

Describe your enhancement idea

Detect that the token is due to (or has already) expired, and automatically perform an APIML login request. Then continue the user's original request.

Describe alternatives you've considered

  • Create APIs to detect token expiration and perform re-authentication.
    • The same (or similar) APIs should be made available to both the CLI and to ZE extenders.

Provide any additional context

@gejohnston gejohnston added enhancement New feature or request new The issue wasn't triaged yet labels Nov 15, 2023
Copy link

Thank you for raising this enhancement request.
The community has 90 days to vote on it.
If the enhancement receives at least 5 upvotes, it is added to our development backlog.
If it receives fewer votes, the issue is closed.

@balhar-jakub
Copy link
Member

Just a note there is API available via API ML for this type of exchange - https://docs.zowe.org/stable/user-guide/api-mediation/api-mediation-jwt-token-refresh/

It's not enabled by default, but I wanted to let you know, in case this is something you want to use, but it may be better to use the Personal Access Tokens for the authentication against the API Mediation Layer.

@JTonda JTonda added priority-low Legit issue but cosmetic or nice-to-have and removed new The issue wasn't triaged yet labels Nov 20, 2023
@zFernand0
Copy link
Member

Here is a bit more information about the APIs we could write in a non-breaking enhancement to the Imperative framework.

Thanks to the APIML Token structure, we could split it into 3 portions.

  1. Token identification information: type (JWT), algorithm (RS256), and kID (???)
    {
      "kid": "some_generated_token_id",
      "typ": "JWT",
      "alg": "RS256"
    }
  2. Personal identification information: type, user, SAF Groups, issuer, expiration, iat (issued at time?), and more...
    {
      "token_type": "Bearer",
      "sub": "USERNAME",
      "upn": "USERNAME",
      "groups": ["IZUUSER","ZWEADMIN", "MORE_GROUPS"],
      "realm": "SAFRealm",
      "iss": "zOSMF",
      "exp": 1700278625,
      "iat": 1700248625
    }
  3. Some very long generated hash/string/token (no point in base64 decoding it 😋 )

The API may look something like this.

export class CliUtils {
  // ...
  public static getTokenExpirationTime(apimlToken: string): string {
    // This is just pseudo-code : )
    const tokenDetails = JSON.parse(base64Decode(apimlToken.split(".")[1]));
    return tokenDetails.exp;
  }

@zFernand0 zFernand0 removed their assignment Nov 22, 2023
@t1m0thyj t1m0thyj moved this to Low Priority in Zowe CLI Squad Dec 26, 2023
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the Stale label Feb 20, 2024
Copy link

github-actions bot commented Mar 5, 2024

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2024
@github-project-automation github-project-automation bot moved this from Low Priority to Closed in Zowe CLI Squad Mar 5, 2024
@adam-wolfe
Copy link
Contributor

I think this is still something we should consider, even if only to avoid passing an expired token to the API ML.

@adam-wolfe adam-wolfe reopened this Mar 5, 2024
@github-project-automation github-project-automation bot moved this from Closed to New Issues in Zowe CLI Squad Mar 5, 2024
@github-actions github-actions bot removed the Stale label Mar 6, 2024
@JTonda JTonda added the keep Issues with this label will be ignored by the stale bot label Mar 6, 2024
@JTonda JTonda moved this from New Issues to Low Priority in Zowe CLI Squad Mar 6, 2024
@gejohnston gejohnston moved this from Low Priority to In Progress in Zowe CLI Squad Jul 29, 2024
@JTonda JTonda moved this from In Progress to Low Priority in Zowe CLI Squad Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request keep Issues with this label will be ignored by the stale bot priority-low Legit issue but cosmetic or nice-to-have
Projects
Status: Low Priority
Development

No branches or pull requests

5 participants