Browse Source

Use substring instead of replaceFirst in OAuth2AuthorizationConsent

Closes gh-1222
pull/1260/head
heartape 3 years ago committed by Joe Grandja
parent
commit
a73181153d
  1. 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationConsent.java

4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationConsent.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 the original author or authors.
* Copyright 2020-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -93,7 +93,7 @@ public final class OAuth2AuthorizationConsent implements Serializable { @@ -93,7 +93,7 @@ public final class OAuth2AuthorizationConsent implements Serializable {
Set<String> authorities = new HashSet<>();
for (GrantedAuthority authority : getAuthorities()) {
if (authority.getAuthority().startsWith(AUTHORITIES_SCOPE_PREFIX)) {
authorities.add(authority.getAuthority().replaceFirst(AUTHORITIES_SCOPE_PREFIX, ""));
authorities.add(authority.getAuthority().substring(AUTHORITIES_SCOPE_PREFIX.length()));
}
}
return authorities;

Loading…
Cancel
Save