change authentication parameters to match oauth spec

This commit is contained in:
Sebastian Sdorra
2017-02-09 20:52:53 +01:00
parent 1b8370fd1f
commit e0d42d7c92
9 changed files with 44 additions and 33 deletions

View File

@@ -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 ){

View File

@@ -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);