Skip to content

Commit 33d9485

Browse files
committed
Merge branch 'hotfix/revoke-pat' into hotfix/21.1.4
2 parents f2c8f4c + e719322 commit 33d9485

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/io/cos/cas/osf/model/OsfOAuth20Pat.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ public class OsfOAuth20Pat extends AbstractOsfModel {
3636
@JoinColumn(name = "owner_id")
3737
private OsfUser owner;
3838

39+
/**
40+
* Check if the personal access token has been deactivated.
41+
*
42+
* @return {@code true} or {@code false}
43+
*/
44+
public Boolean isActive() {
45+
return isActive;
46+
}
47+
3948
@Override
4049
public String toString() {
4150
return String.format("OsfOAuth20Pat [name=%s, owner=%s]", name, owner.getUsername());

src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20UserProfileEndpointController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ protected OAuth20AccessToken attemptToGenerateAccessTokenFromOsfPat(final String
181181

182182
// Attempt to find the OSF personal access token by the given token ID from the OSF database
183183
val osfPersonalAccessToken = getJpaOsfDao().findOnePatByTokenId(tokenId);
184-
if (osfPersonalAccessToken == null) {
184+
if (osfPersonalAccessToken == null || !osfPersonalAccessToken.isActive()) {
185185
LOGGER.warn("Cannot find OSF OAuth 2.0 PAT with id=[{}] in the OSF database", tokenId);
186186
return null;
187187
}

0 commit comments

Comments
 (0)