more extensible oauth filter

This commit is contained in:
Brian Long 2022-03-08 13:29:14 -05:00
parent 95730a9440
commit b4d7d2a154

View File

@ -101,6 +101,7 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
form.param("client_secret", this.clientSecret);
if (this.scope != null)
form.param("scope", this.scope);
this.extendRefreshTokenForm(form);
Entity<Form> entity = Entity.form(form);
@ -118,6 +119,7 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
this.accessToken = (String)response.get("access_token");
this.expiration = System.currentTimeMillis() + ((Number)response.get("expires_in")).longValue() * 1000L;
this.refreshToken = (String)response.get("refresh_token");
this.extendRefreshTokenResponse(response);
}
protected Form createRefreshForm() {
@ -126,5 +128,11 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
}
protected abstract Form createForm();
protected void extendRefreshTokenForm(Form form) {
}
protected void extendRefreshTokenResponse(Map<String, Object> response) {
}
}