-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acb14fb
commit 27597ec
Showing
1 changed file
with
25 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,47 +42,52 @@ public class ClientRegistrationTestSupport { | |
public static final String LEGACY_REGISTER_ENDPOINT = "/register"; | ||
|
||
public static class ClientJsonStringBuilder { | ||
|
||
static final Joiner JOINER = Joiner.on(RegisteredClientFields.SCOPE_SEPARATOR); | ||
|
||
String name = "test_client"; | ||
Set<String> redirectUris = Sets.newHashSet("http://localhost:9090"); | ||
Set<String> grantTypes = Sets.newHashSet("client_credentials"); | ||
Set<String> scopes = Sets.newHashSet(); | ||
Set<String> responseTypes = Sets.newHashSet(); | ||
|
||
private ClientJsonStringBuilder() { | ||
} | ||
int accessTokenValiditySeconds = 3600; | ||
|
||
private ClientJsonStringBuilder() {} | ||
|
||
public static ClientJsonStringBuilder builder() { | ||
return new ClientJsonStringBuilder(); | ||
} | ||
|
||
public ClientJsonStringBuilder name(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
public ClientJsonStringBuilder redirectUris(String...uris) { | ||
|
||
public ClientJsonStringBuilder redirectUris(String... uris) { | ||
this.redirectUris = Sets.newHashSet(uris); | ||
return this; | ||
} | ||
public ClientJsonStringBuilder grantTypes(String...grantTypes) { | ||
|
||
public ClientJsonStringBuilder grantTypes(String... grantTypes) { | ||
this.grantTypes = Sets.newHashSet(grantTypes); | ||
return this; | ||
} | ||
public ClientJsonStringBuilder scopes(String...scopes) { | ||
|
||
public ClientJsonStringBuilder scopes(String... scopes) { | ||
this.scopes = Sets.newHashSet(scopes); | ||
return this; | ||
} | ||
public ClientJsonStringBuilder responseTypes(String...responseTypes) { | ||
|
||
public ClientJsonStringBuilder responseTypes(String... responseTypes) { | ||
this.responseTypes = Sets.newHashSet(responseTypes); | ||
return this; | ||
} | ||
|
||
|
||
public ClientJsonStringBuilder accessTokenValiditySeconds(int accessTokenValiditySeconds) { | ||
this.accessTokenValiditySeconds = accessTokenValiditySeconds; | ||
return this; | ||
} | ||
|
||
public String build() { | ||
JsonObject json = new JsonObject(); | ||
json.addProperty(CLIENT_NAME, name); | ||
|
@@ -93,12 +98,12 @@ public String build() { | |
json.add(CLAIMS_REDIRECT_URIS, getAsArray(newHashSet(), true)); | ||
json.add(REQUEST_URIS, getAsArray(newHashSet(), true)); | ||
json.add(CONTACTS, getAsArray(newHashSet("[email protected]"))); | ||
|
||
json.addProperty("access_token_validity_seconds", accessTokenValiditySeconds); | ||
return json.toString(); | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
protected String setToString(Set<String> scopes) { | ||
|