Skip to content
Snippets Groups Projects
Commit 73bbfaea authored by Martin Vogel's avatar Martin Vogel
Browse files

#414 Add all scopes to the token request

parent b1348139
No related branches found
No related tags found
2 merge requests!2#414 Remaining changes from MR,!1planning#414 Methoden Signaturen (Zwischenstand)
......@@ -39,9 +39,12 @@ public class DefaultOAuthService implements OAuthService {
put("grant_type", "client_credentials");
put("client_id", clientId);
put("client_secret", clientSecret);
}};
Arrays.stream(scope).forEach(s -> data.put("scope", s));
if(scope.length > 0){
data.put("scope", String.join(",", scope));
}
return data.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(joining("&"));
}
......
......@@ -20,13 +20,14 @@ class OAuthTokenIntegrationTest {
var tokenUrl = "https://auth-testing.fit-connect.fitko.dev/token";
var clientId = "781f6213-0f0f-4a79-9372-e7187ffda98b";
var secret = "PnzR8Vbmhpv_VwTkT34wponqXWK8WBm-LADlryYdV4o";
var scope = "send:region:DE";
var scope1 = "send:region:DE";
var scope2 = "send:region:EN";
var authService = new DefaultOAuthService( new RestTemplate(), tokenUrl);
final Sender sender = new SubmissionSender(authService, null, null, null);
// When
Optional<OAuthToken> token = sender.retrieveOAuthToken(clientId, secret, scope);
Optional<OAuthToken> token = sender.retrieveOAuthToken(clientId, secret, scope1,scope2);
// Then
assertTrue(token.isPresent());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment