Skip to content

Commit a731811

Browse files
heartapejgrandja
authored andcommitted
Use substring instead of replaceFirst in OAuth2AuthorizationConsent
Closes gh-1222
1 parent 00c114c commit a731811

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2022 the original author or authors.
2+
* Copyright 2020-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ public Set<String> getScopes() {
9393
Set<String> authorities = new HashSet<>();
9494
for (GrantedAuthority authority : getAuthorities()) {
9595
if (authority.getAuthority().startsWith(AUTHORITIES_SCOPE_PREFIX)) {
96-
authorities.add(authority.getAuthority().replaceFirst(AUTHORITIES_SCOPE_PREFIX, ""));
96+
authorities.add(authority.getAuthority().substring(AUTHORITIES_SCOPE_PREFIX.length()));
9797
}
9898
}
9999
return authorities;

0 commit comments

Comments
 (0)