Skip to content

Commit

Permalink
Merge tag '0.5.1' into develop
Browse files Browse the repository at this point in the history
0.5.1
  • Loading branch information
infeo committed Jul 4, 2022
2 parents 2a4a20c + 9b6aa7f commit 664c04a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ URI buildAuthUri(URI redirectEndpoint, String csrfToken, Set<String> scopes) {
"state", csrfToken, //
"code_challenge", pkce.getChallenge(), //
"code_challenge_method", PKCE.METHOD, //
"redirect_uri", redirectEndpoint.toASCIIString(), //
"scope", String.join(" ", scopes)
"redirect_uri", redirectEndpoint.toASCIIString()
));

if(scopes.size() > 0) {
queryString += "&" + URIUtil.buildQueryString(Map.of("scope" ,String.join(" ", scopes)));
}
return URI.create(authEndpoint.getScheme() + "://" + authEndpoint.getRawAuthority() + authEndpoint.getRawPath() + "?" + queryString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void testBuildAuthUri(URI authEndpoint, URI redirectEndpoint, String csrf

public static Stream<Arguments> testBuildAuthUri() {
return Stream.of( //
Arguments.of(URI.create("https://login.example.com/"), URI.create("http://127.0.0.1/callback"), "token", Set.of(), URI.create("https://login.example.com/?state=token&scope&code_challenge=C0D3Ch4ll3ng3&response_type=code&client_id=my-client&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback")), //
Arguments.of(URI.create("https://login.example.com/"), URI.create("http://127.0.0.1/callback"), "token", Set.of(), URI.create("https://login.example.com/?state=token&code_challenge=C0D3Ch4ll3ng3&response_type=code&client_id=my-client&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback")), //
Arguments.of(URI.create("https://login.example.com/?foo=bar"), URI.create("http://127.0.0.1/callback"), "token", Set.of(""), URI.create("https://login.example.com/?state=token&scope&code_challenge=C0D3Ch4ll3ng3&response_type=code&client_id=my-client&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback&foo=bar")), //
Arguments.of(URI.create("https://login.example.com/"), URI.create("http://127.0.0.1/callback"), "t0k3n", Set.of("offline_access"), URI.create("https://login.example.com/?state=t0k3n&scope=offline_access&code_challenge=C0D3Ch4ll3ng3&response_type=code&client_id=my-client&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback")), //
Arguments.of(URI.create("https://login.example.com/?foo=bar"), URI.create("http://127.0.0.1/callback"), "token", Set.of("offline_access"), URI.create("https://login.example.com/?state=token&scope=offline_access&code_challenge=C0D3Ch4ll3ng3&response_type=code&client_id=my-client&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback&foo=bar")), //
Expand Down

0 comments on commit 664c04a

Please sign in to comment.