clearing out refresh tokens is now configurable, closes #409
parent
8359ac2813
commit
2f4d9ce54b
|
@ -140,6 +140,7 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
private boolean allowIntrospection = false; // do we let this client call the introspection endpoint?
|
private boolean allowIntrospection = false; // do we let this client call the introspection endpoint?
|
||||||
private Integer idTokenValiditySeconds; //timeout for id tokens
|
private Integer idTokenValiditySeconds; //timeout for id tokens
|
||||||
private Date createdAt; // time the client was created
|
private Date createdAt; // time the client was created
|
||||||
|
private boolean clearAccessTokensOnRefresh = true; // do we clear access tokens on refresh?
|
||||||
|
|
||||||
public enum AuthMethod {
|
public enum AuthMethod {
|
||||||
SECRET_POST("client_secret_post"),
|
SECRET_POST("client_secret_post"),
|
||||||
|
@ -948,4 +949,20 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the clearAccessTokensOnRefresh
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Column(name = "clear_access_tokens_on_refresh")
|
||||||
|
public boolean isClearAccessTokensOnRefresh() {
|
||||||
|
return clearAccessTokensOnRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clearAccessTokensOnRefresh the clearAccessTokensOnRefresh to set
|
||||||
|
*/
|
||||||
|
public void setClearAccessTokensOnRefresh(boolean clearAccessTokensOnRefresh) {
|
||||||
|
this.clearAccessTokensOnRefresh = clearAccessTokensOnRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,8 @@ CREATE TABLE IF NOT EXISTS client_details (
|
||||||
require_auth_time BOOLEAN,
|
require_auth_time BOOLEAN,
|
||||||
created_at TIMESTAMP,
|
created_at TIMESTAMP,
|
||||||
initiate_login_uri VARCHAR(2048),
|
initiate_login_uri VARCHAR(2048),
|
||||||
post_logout_redirect_uri VARCHAR(2048),
|
clear_access_tokens_on_refresh BOOLEAN DEFAULT true NOT NULL,
|
||||||
|
|
||||||
UNIQUE (client_id)
|
UNIQUE (client_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ var ClientModel = Backbone.Model.extend({
|
||||||
|
|
||||||
clientDescription:"",
|
clientDescription:"",
|
||||||
reuseRefreshToken:true,
|
reuseRefreshToken:true,
|
||||||
|
clearAccessTokensOnRefresh:true,
|
||||||
dynamicallyRegistered:false,
|
dynamicallyRegistered:false,
|
||||||
allowIntrospection:false,
|
allowIntrospection:false,
|
||||||
idTokenValiditySeconds: null,
|
idTokenValiditySeconds: null,
|
||||||
|
@ -966,6 +967,7 @@ var ClientFormView = Backbone.View.extend({
|
||||||
initiateLoginUri: $('#initiateLoginUri input').val(),
|
initiateLoginUri: $('#initiateLoginUri input').val(),
|
||||||
postLogoutRedirectUris: this.postLogoutRedirectUrisCollection.pluck('item'),
|
postLogoutRedirectUris: this.postLogoutRedirectUrisCollection.pluck('item'),
|
||||||
reuseRefreshToken: $('#reuseRefreshToken').is(':checked'),
|
reuseRefreshToken: $('#reuseRefreshToken').is(':checked'),
|
||||||
|
clearAccessTokensOnRefresh: $('#clearAccessTokensOnRefresh').is(':checked'),
|
||||||
requireAuthTime: $('#requireAuthTime input').is(':checked'),
|
requireAuthTime: $('#requireAuthTime input').is(':checked'),
|
||||||
defaultMaxAge: parseInt($('#defaultMaxAge input').val()),
|
defaultMaxAge: parseInt($('#defaultMaxAge input').val()),
|
||||||
contacts: this.contactsCollection.pluck('item'),
|
contacts: this.contactsCollection.pluck('item'),
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
"refresh-tokens-issued": "Refresh tokens are issued for this client",
|
"refresh-tokens-issued": "Refresh tokens are issued for this client",
|
||||||
"refresh-tokens-issued-help": "This will add the offline_access scope to the client's scopes.",
|
"refresh-tokens-issued-help": "This will add the offline_access scope to the client's scopes.",
|
||||||
"refresh-tokens-reused": "Refresh tokens for this client are re-used",
|
"refresh-tokens-reused": "Refresh tokens for this client are re-used",
|
||||||
|
"clear-access-tokens": "Active access tokens are automatically revoked when the refresh token is used",
|
||||||
"refresh-tokens-no-expire": "Refresh tokens do not time out",
|
"refresh-tokens-no-expire": "Refresh tokens do not time out",
|
||||||
"registered": "Registered at",
|
"registered": "Registered at",
|
||||||
"registration-token": "Registration Token:",
|
"registration-token": "Registration Token:",
|
||||||
|
|
|
@ -570,6 +570,10 @@
|
||||||
<label for="reuseRefreshToken" class="checkbox" data-i18n="client.client-form.refresh-tokens-reused">Refresh tokens for this client are re-used</label>
|
<label for="reuseRefreshToken" class="checkbox" data-i18n="client.client-form.refresh-tokens-reused">Refresh tokens for this client are re-used</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<input type="checkbox" id="clearAccessTokensOnRefresh" <%-(clearAccessTokensOnRefresh == true ? 'checked' : '')%>>
|
||||||
|
<label for="clearAccessTokensOnRefresh" class="checkbox" data-i18n="client.client-form.clear-access-tokens">Active access tokens are revoked when the refresh token is used</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<input type="checkbox" id="disableRefreshTokenTimeout" <%-(refreshTokenValiditySeconds == null ? 'checked' : '')%>/>
|
<input type="checkbox" id="disableRefreshTokenTimeout" <%-(refreshTokenValiditySeconds == null ? 'checked' : '')%>/>
|
||||||
<label for="disableRefreshTokenTimeout" class="checkbox" data-i18n="client.client-form.refresh-tokens-no-expire">Refresh tokens do not time out</label>
|
<label for="disableRefreshTokenTimeout" class="checkbox" data-i18n="client.client-form.refresh-tokens-no-expire">Refresh tokens do not time out</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -261,8 +261,9 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear out any access tokens
|
// clear out any access tokens
|
||||||
// TODO: make this a configurable option
|
if (client.isClearAccessTokensOnRefresh()) {
|
||||||
tokenRepository.clearAccessTokensForRefreshToken(refreshToken);
|
tokenRepository.clearAccessTokensForRefreshToken(refreshToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (refreshToken.isExpired()) {
|
if (refreshToken.isExpired()) {
|
||||||
tokenRepository.removeRefreshToken(refreshToken);
|
tokenRepository.removeRefreshToken(refreshToken);
|
||||||
|
|
Loading…
Reference in New Issue