Add support for Resource Owner Password Credentials grant

Fixes gh-6003
This commit is contained in:
Joe Grandja
2019-06-16 19:30:42 -04:00
parent de672e3ae9
commit dcd997ea43
38 changed files with 2393 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ public final class AuthorizationGrantType implements Serializable {
public static final AuthorizationGrantType IMPLICIT = new AuthorizationGrantType("implicit");
public static final AuthorizationGrantType REFRESH_TOKEN = new AuthorizationGrantType("refresh_token");
public static final AuthorizationGrantType CLIENT_CREDENTIALS = new AuthorizationGrantType("client_credentials");
public static final AuthorizationGrantType PASSWORD = new AuthorizationGrantType("password");
private final String value;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,6 +85,16 @@ public interface OAuth2ParameterNames {
*/
String REFRESH_TOKEN = "refresh_token";
/**
* {@code username} - used in Access Token Request.
*/
String USERNAME = "username";
/**
* {@code password} - used in Access Token Request.
*/
String PASSWORD = "password";
/**
* {@code error} - used in Authorization Response and Access Token Response.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,4 +45,9 @@ public class AuthorizationGrantTypeTests {
public void getValueWhenRefreshTokenGrantTypeThenReturnRefreshToken() {
assertThat(AuthorizationGrantType.REFRESH_TOKEN.getValue()).isEqualTo("refresh_token");
}
@Test
public void getValueWhenPasswordGrantTypeThenReturnPassword() {
assertThat(AuthorizationGrantType.PASSWORD.getValue()).isEqualTo("password");
}
}