|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -45,14 +45,10 @@ public final class JwtGrantedAuthoritiesConverter implements Converter<Jwt, Coll
|
45 | 45 |
|
46 | 46 | private static final String DEFAULT_AUTHORITY_PREFIX = "SCOPE_";
|
47 | 47 |
|
48 |
| - private static final String DEFAULT_AUTHORITIES_SPLIT_REGEX = " "; |
49 |
| - |
50 | 48 | private static final Collection<String> WELL_KNOWN_AUTHORITIES_CLAIM_NAMES = Arrays.asList("scope", "scp");
|
51 | 49 |
|
52 | 50 | private String authorityPrefix = DEFAULT_AUTHORITY_PREFIX;
|
53 | 51 |
|
54 |
| - private String authoritiesSplitRegex = DEFAULT_AUTHORITIES_SPLIT_REGEX; |
55 |
| - |
56 | 52 | private String authoritiesClaimName;
|
57 | 53 |
|
58 | 54 | /**
|
@@ -81,18 +77,6 @@ public void setAuthorityPrefix(String authorityPrefix) {
|
81 | 77 | this.authorityPrefix = authorityPrefix;
|
82 | 78 | }
|
83 | 79 |
|
84 |
| - /** |
85 |
| - * Sets the regex to use for splitting the value of the authorities claim into |
86 |
| - * {@link GrantedAuthority authorities}. Defaults to |
87 |
| - * {@link JwtGrantedAuthoritiesConverter#DEFAULT_AUTHORITIES_SPLIT_REGEX}. |
88 |
| - * @param authoritiesSplitRegex The regex used to split the authorities |
89 |
| - * @since 6.1 |
90 |
| - */ |
91 |
| - public void setAuthoritiesSplitRegex(String authoritiesSplitRegex) { |
92 |
| - Assert.notNull(authoritiesSplitRegex, "authoritiesSplitRegex cannot be null"); |
93 |
| - this.authoritiesSplitRegex = authoritiesSplitRegex; |
94 |
| - } |
95 |
| - |
96 | 80 | /**
|
97 | 81 | * Sets the name of token claim to use for mapping {@link GrantedAuthority
|
98 | 82 | * authorities} by this converter. Defaults to
|
@@ -129,7 +113,7 @@ private Collection<String> getAuthorities(Jwt jwt) {
|
129 | 113 | Object authorities = jwt.getClaim(claimName);
|
130 | 114 | if (authorities instanceof String) {
|
131 | 115 | if (StringUtils.hasText((String) authorities)) {
|
132 |
| - return Arrays.asList(((String) authorities).split(this.authoritiesSplitRegex)); |
| 116 | + return Arrays.asList(((String) authorities).split(" ")); |
133 | 117 | }
|
134 | 118 | return Collections.emptyList();
|
135 | 119 | }
|
|
0 commit comments