Skip to content

Commit

Permalink
Remove scope attribute from OAuth2TokenData.
Browse files Browse the repository at this point in the history
Since the introduction of OAuth2 the scope attribute
of all saved tokens has been "null", as there seemed to
be a bug with ScribeJava. Upgrading from v3.3.6 to v6.8.1
resulted in exceptions due to the scope being saved now,
but violating the 64 char limit.

As the persisted data has not been in use ever since
(the scope is always retrieved from the IdP implementation),
the attribute has been removed to save database space and
avoid the exception.

An appropriate SQL migration script for Flyway has been added.
Relates to IQSS#5991.
  • Loading branch information
poikilotherm committed Sep 23, 2019
1 parent a51497f commit 81b367b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public class OAuth2TokenData implements Serializable {
@Column(length = 64)
private String refreshToken;

@Column(length = 64)
private String scope;

@Column(length = 32)
private String tokenType;

Expand All @@ -78,7 +75,6 @@ public static OAuth2TokenData from( OAuth2AccessToken accessTokenResponse ) {
OAuth2TokenData retVal = new OAuth2TokenData();
retVal.setAccessToken(accessTokenResponse.getAccessToken());
retVal.setRefreshToken( accessTokenResponse.getRefreshToken() );
retVal.setScope( accessTokenResponse.getScope() );
retVal.setTokenType( accessTokenResponse.getTokenType() );
if ( accessTokenResponse.getExpiresIn() != null ) {
retVal.setExpiryDate( new Timestamp( System.currentTimeMillis() + accessTokenResponse.getExpiresIn()));
Expand Down Expand Up @@ -136,14 +132,6 @@ public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}

public String getScope() {
return scope;
}

public void setScope(String scope) {
this.scope = scope;
}

public String getTokenType() {
return tokenType;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE OAuth2TokenData DROP COLUMN IF EXISTS scope;

0 comments on commit 81b367b

Please sign in to comment.