Skip to content

Commit 415f07c

Browse files
jorbaumKehrlann
authored andcommitted
Support JWT GrantType
1 parent 77fb427 commit 415f07c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/uaa/clients/ReactorClientsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
2525
import static org.cloudfoundry.uaa.tokens.GrantType.AUTHORIZATION_CODE;
2626
import static org.cloudfoundry.uaa.tokens.GrantType.CLIENT_CREDENTIALS;
27+
import static org.cloudfoundry.uaa.tokens.GrantType.JWT_BEARER;
2728
import static org.cloudfoundry.uaa.tokens.GrantType.REFRESH_TOKEN;
2829

2930
import java.time.Duration;
@@ -620,6 +621,7 @@ void get() {
620621
.allowedProviders("uaa", "ldap", "my-saml-provider")
621622
.authorities("clients.read", "clients.write")
622623
.authorizedGrantType(CLIENT_CREDENTIALS)
624+
.authorizedGrantType(JWT_BEARER)
623625
.autoApprove("true")
624626
.clientId("4Z3t1r")
625627
.lastModified(1468364445592L)

cloudfoundry-client-reactor/src/test/resources/fixtures/uaa/clients/GET_{id}_response.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"none"
99
],
1010
"authorized_grant_types": [
11-
"client_credentials"
11+
"client_credentials",
12+
"urn:ietf:params:oauth:grant-type:jwt-bearer"
1213
],
1314
"redirect_uri": [
1415
"http*://ant.path.wildcard/**/passback/*",

cloudfoundry-client/src/main/java/org/cloudfoundry/uaa/tokens/GrantType.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public enum GrantType {
3939
*/
4040
IMPLICIT("implicit"),
4141

42+
/**
43+
* The JWT bearer grant type
44+
*/
45+
JWT_BEARER("urn:ietf:params:oauth:grant-type:jwt-bearer"),
46+
4247
/**
4348
* The password grant type
4449
*/
@@ -68,6 +73,8 @@ public static GrantType from(String s) {
6873
return PASSWORD;
6974
case "refresh_token":
7075
return REFRESH_TOKEN;
76+
case "urn:ietf:params:oauth:grant-type:jwt-bearer":
77+
return JWT_BEARER;
7178
default:
7279
throw new IllegalArgumentException(String.format("Unknown grant type: %s", s));
7380
}

0 commit comments

Comments
 (0)