mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
change authentication parameters to match oauth spec
This commit is contained in:
@@ -108,15 +108,17 @@ public class AuthorizationScopeITCase {
|
||||
|
||||
private String createAuthenticationToken(String scope) {
|
||||
Client client = createClient();
|
||||
String url = createResourceUrl("authentication/login");
|
||||
if (!Strings.isNullOrEmpty(scope)) {
|
||||
url = url.concat("?scope=").concat(scope);
|
||||
}
|
||||
String url = createResourceUrl("auth/access_token");
|
||||
|
||||
WebResource wr = client.resource(url);
|
||||
MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
|
||||
|
||||
formData.add("username", ADMIN_USERNAME);
|
||||
formData.add("password", ADMIN_PASSWORD);
|
||||
formData.add("grant_type", "password");
|
||||
if (!Strings.isNullOrEmpty(scope)) {
|
||||
formData.add("scope", scope);
|
||||
}
|
||||
|
||||
ClientResponse response = wr.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);
|
||||
if (response.getStatus() >= 300 ){
|
||||
|
||||
@@ -110,17 +110,16 @@ public final class IntegrationTestUtil
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ClientResponse authenticate(Client client, String username,
|
||||
String password)
|
||||
{
|
||||
WebResource wr = client.resource(createResourceUrl("authentication/login").concat("?cookie=true"));
|
||||
public static ClientResponse authenticate(Client client, String username, String password) {
|
||||
WebResource wr = client.resource(createResourceUrl("auth/access_token"));
|
||||
MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
|
||||
|
||||
formData.add("username", username);
|
||||
formData.add("password", password);
|
||||
formData.add("cookie", "true");
|
||||
formData.add("grant_type", "password");
|
||||
|
||||
return wr.type("application/x-www-form-urlencoded").post(
|
||||
ClientResponse.class, formData);
|
||||
return wr.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +293,7 @@ public final class IntegrationTestUtil
|
||||
*/
|
||||
public static void logoutClient(Client client)
|
||||
{
|
||||
WebResource wr = createResource(client, "authentication/logout");
|
||||
WebResource wr = createResource(client, "auth/logout");
|
||||
ClientResponse response = wr.get(ClientResponse.class);
|
||||
|
||||
assertNotNull(response);
|
||||
|
||||
Reference in New Issue
Block a user