Skip to content

Commit

Permalink
Set negative RT lifetimes to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
federicaagostini committed Sep 6, 2023
1 parent 4d65871 commit 0d5c7c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public ClientDetailsEntity entityFromClientManagementRequest(RegisteredClientDTO

if (dto.getAccessTokenValiditySeconds() != null) {
if (dto.getAccessTokenValiditySeconds() <= 0) {
client.setAccessTokenValiditySeconds(null);
client.setAccessTokenValiditySeconds(0);
} else {
client.setAccessTokenValiditySeconds(dto.getAccessTokenValiditySeconds());
}
}
if (dto.getRefreshTokenValiditySeconds() != null) {
if (dto.getRefreshTokenValiditySeconds() <= 0) {
client.setRefreshTokenValiditySeconds(null);
client.setRefreshTokenValiditySeconds(0);
} else {
client.setRefreshTokenValiditySeconds(dto.getRefreshTokenValiditySeconds());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
self.hasDeviceCodeGrantType = false;
self.accessTokenValiditySeconds = getAccessTokenValiditySeconds();
self.refreshTokenValiditySeconds = getRefreshTokenValiditySeconds();
self.rtDoNotExpire = false;

self.$onInit = function () {
console.debug('TokenSettingsController.self', self);
if (!self.client.access_token_validity_seconds) {
if (self.client.access_token_validity_seconds == null) {
self.client.access_token_validity_seconds = self.accessTokenValiditySeconds;
}

if (!self.client.refresh_token_validity_seconds) {
if (self.client.refresh_token_validity_seconds == null) {
self.client.refresh_token_validity_seconds = self.refreshTokenValiditySeconds;
}

Expand All @@ -47,14 +46,9 @@
});

$scope.$watch('$ctrl.client.refresh_token_validity_seconds', function handleChange(newVal, oldVal) {

if (newVal <= 0) {
self.client.refresh_token_validity_seconds = 0;
self.rtDoNotExpire = true;
} else {
self.rtDoNotExpire = false;
}

});

$scope.$watch('$ctrl.client.grant_types', function handleChange(newVal, oldVal) {
Expand Down

0 comments on commit 0d5c7c7

Please sign in to comment.