Commit b4d7d2a1 authored by Brian Long's avatar Brian Long
Browse files

more extensible oauth filter

parent 95730a94
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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() {
@@ -127,4 +129,10 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
	
	protected abstract Form createForm();
	
	protected void extendRefreshTokenForm(Form form) {
	}
	
	protected void extendRefreshTokenResponse(Map<String, Object> response) {
	}

}