2828 */
2929public class Jwt {
3030
31- protected Set < String > scopes = new HashSet <>() ;
31+ protected String scopes ;
3232 protected Key key ;
3333 /**
3434 * This is the client credentials token config if multiple auth servers are used.
@@ -140,19 +140,19 @@ public void setCcConfig(Map<String, Object> ccConfig) {
140140 this .ccConfig = ccConfig ;
141141 }
142142
143- public Set <String > getScopes () {
144- return scopes ;
143+ public Set <String > getScopesSet () {
144+ Set <String > scopesSet = new HashSet <>();
145+ if (StringUtils .isBlank (scopes )) return scopesSet ;
146+ scopesSet .addAll (Arrays .asList (scopes .split ("(\\ s)+" )));
147+ return scopesSet ;
145148 }
146149
147- public void setScopes ( Set < String > scopes ) {
148- this . scopes = scopes ;
150+ public String getScopes ( ) {
151+ return scopes ;
149152 }
150153
151- public void setScopes (String scopesStr ) {
152- this .scopes = this .scopes == null ? new HashSet () : this .scopes ;
153- if (StringUtils .isNotBlank (scopesStr )) {
154- scopes .addAll (Arrays .asList (scopesStr .split ("(\\ s)+" )));
155- }
154+ public void setScopes (String scopes ) {
155+ this .scopes = scopes ;
156156 }
157157
158158 public Key getKey () {
@@ -167,7 +167,7 @@ public static class Key {
167167 /**
168168 * scopes should be extendable by its children
169169 */
170- protected Set < String > scopes ;
170+ protected String scopes ;
171171 /**
172172 * serviceId should be extendable by its children
173173 */
@@ -183,7 +183,8 @@ public boolean equals(Object obj) {
183183 return hashCode () == obj .hashCode ();
184184 }
185185
186- public Key (Set <String > scopes ) {
186+ public Key (String serviceId , String scopes ) {
187+ this .serviceId = serviceId ;
187188 this .scopes = scopes ;
188189 }
189190
@@ -192,13 +193,28 @@ public Key(String serviceId) {
192193 }
193194
194195 public Key () {
195- this . scopes = new HashSet <>();
196+
196197 }
197198
198- public Set < String > getScopes () {
199+ public String getScopes () {
199200 return scopes ;
200201 }
201202
203+ public Set <String > getScopesSet () {
204+ Set <String > scopesSet = new HashSet <>();
205+ if (StringUtils .isBlank (scopes )) return scopesSet ;
206+ scopesSet .addAll (Arrays .asList (scopes .split ("(\\ s)+" )));
207+ return scopesSet ;
208+ }
209+
210+ public void setScopes (String scopes ) {
211+ this .scopes = scopes ;
212+ }
213+
214+ public void setServiceId (String serviceId ) {
215+ this .serviceId = serviceId ;
216+ }
217+
202218 public String getServiceId () {
203219 return serviceId ;
204220 }
0 commit comments