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

Issue with "User-Initiated Action Lifespan" #17165

Closed
2 tasks done
AntonioMT88 opened this issue Feb 17, 2023 · 1 comment · Fixed by #20240
Closed
2 tasks done

Issue with "User-Initiated Action Lifespan" #17165

AntonioMT88 opened this issue Feb 17, 2023 · 1 comment · Fixed by #20240
Assignees
Labels
Milestone

Comments

@AntonioMT88
Copy link

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

admin/api

Describe the bug

hi there, i'm implementing some keycloak api for my application (we do not want the users to acced directly to the admin panel) and i believe i've found an issue with the admin api.

This is my code:

`
RealmResource realmResource = keycloakHelper.getInstance().realm(realmName)

    RealmRepresentation realmRepresentation = realmResource.toRepresentation()

    realmRepresentation.setActionTokenGeneratedByUserLifespan(newLifeSpan)

    realmResource.update(realmRepresentation)

`

If i send a newLifeSpan value very high (let's say 100000) and then i go to keycloak admin panel, this is the result

Screenshot 2023-02-17 alle 11 32 08

this is causing that, when i get the verification email, i read that the validation link will be enable for an amount of time mesuread in minutes (and not in hours or day as i espect).
am i doing something wrong or it is indeed a bug?

Version

20.0.3

Expected behavior

the code must automatically calculate the right amount of minutes/hours/days or there must be some parameter that let me specify the unit measure.

Actual behavior

it save a wrong value without specifying the unit measure

How to Reproduce?

try the code i share (with newLifeSpan = 100000) will be enough

Anything else?

No response

@AntonioMT88 AntonioMT88 added kind/bug Categorizes a PR related to a bug status/triage labels Feb 17, 2023
@mposolda
Copy link
Contributor

mposolda commented Mar 22, 2023

I think that this is UI issue, but looks like relatively low priority to me.

Cause: The lifespan specified to RealmRepresentation (or admin API) is always specified in seconds. Then UI automatically transforms into some more proper measure (minutes, hours or days) according to the value specified. Admin console itself allows to specify only minutes, hours or days, so it is fine. The problem can happen just if the value is manually specified by admin REST API. As in that case, if the value is specified manually by admin REST API is not divisible by 60, it cannot be transformed into "minutes". However "seconds" are not available as unit in the UI.

How to fix: I am not sure what we can do here? Maybe add "seconds" back as a valid unit to display (just in case that value is not divisable by 60) as displaying "1" is not very user-friendly?

@AntonioMT88 Workaround is to make sure that your value is divisable by 60 (For example you use 100020 or 99960 instead of 100000).

@ghost ghost added the team/ui label Mar 22, 2023
edewit added a commit to edewit/keycloak that referenced this issue May 9, 2023
edewit added a commit to edewit/keycloak that referenced this issue May 9, 2023
@edewit edewit self-assigned this May 9, 2023
edewit added a commit to edewit/keycloak that referenced this issue May 9, 2023
@edewit edewit closed this as completed in 4326a46 May 11, 2023
edewit added a commit to edewit/keycloak that referenced this issue May 11, 2023
@stianst stianst added this to the 21.1.2 milestone May 25, 2023
stianst pushed a commit that referenced this issue May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants