Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static org.cloudfoundry.uaa.tokens.GrantType.AUTHORIZATION_CODE;
import static org.cloudfoundry.uaa.tokens.GrantType.CLIENT_CREDENTIALS;
import static org.cloudfoundry.uaa.tokens.GrantType.JWT_BEARER;
import static org.cloudfoundry.uaa.tokens.GrantType.REFRESH_TOKEN;

import java.time.Duration;
Expand Down Expand Up @@ -620,6 +621,7 @@ void get() {
.allowedProviders("uaa", "ldap", "my-saml-provider")
.authorities("clients.read", "clients.write")
.authorizedGrantType(CLIENT_CREDENTIALS)
.authorizedGrantType(JWT_BEARER)
.autoApprove("true")
.clientId("4Z3t1r")
.lastModified(1468364445592L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ void list() {
+ " /passcode)")
.build())
.ldapDiscoveryEnabled(false)
.defaultIdentityProvider(
"test-identity-provider")
.accountChooserEnabled(false)
.build())
.name("The Twiglet Zone")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void getInfo() {
.showLoginLinks(true)
.timestamp("2017-09-08T23:11:58+0000")
.zoneName("uaa")
.defaultIdpName("test-idp-name")
.build())
.expectComplete()
.verify(Duration.ofSeconds(5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"none"
],
"authorized_grant_types": [
"client_credentials"
"client_credentials",
"urn:ietf:params:oauth:grant-type:jwt-bearer"
],
"redirect_uri": [
"http*://ant.path.wildcard/**/passback/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"text": "One Time Code (Get on at /passcode)"
}
],
"defaultIdentityProvider": "test-identity-provider",
"idpDiscoveryEnabled": false,
"accountChooserEnabled": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"One Time Code ( Get one at http://localhost:8080/uaa/passcode )"
]
},
"timestamp": "2017-09-08T23:11:58+0000"
"timestamp": "2017-09-08T23:11:58+0000",
"defaultIdpName": "test-idp-name"
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ abstract class _IdentityZoneConfiguration {
@Nullable
abstract CorsPolicy getCorsPolicy();

/**
* The default identity provider for this zone
*/
@JsonProperty("defaultIdentityProvider")
@Nullable
abstract String getDefaultIdentityProvider();

/**
* The issuer of this zone
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,12 @@ abstract class _GetInfoResponse {
@Nullable
abstract String getZoneName();

/**
* The default identity provider name
*/
@JsonProperty("defaultIdpName")
@Nullable
abstract String getDefaultIdpName();


}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public enum GrantType {
*/
IMPLICIT("implicit"),

/**
* The JWT bearer grant type
*/
JWT_BEARER("urn:ietf:params:oauth:grant-type:jwt-bearer"),

/**
* The password grant type
*/
Expand Down Expand Up @@ -68,6 +73,8 @@ public static GrantType from(String s) {
return PASSWORD;
case "refresh_token":
return REFRESH_TOKEN;
case "urn:ietf:params:oauth:grant-type:jwt-bearer":
return JWT_BEARER;
default:
throw new IllegalArgumentException(String.format("Unknown grant type: %s", s));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,17 @@ public void getInfo() {
this.uaaClient
.serverInformation()
.getInfo(GetInfoRequest.builder().build())
.map(response -> response.getLinks().getPassword())
.map(response -> response.getLinks().getLogin())
.as(StepVerifier::create)
.consumeNextWith(endsWithExpectation("password"))
.consumeNextWith(containsExpectation("login"))
.expectComplete()
.verify(Duration.ofMinutes(5));
}

private static Consumer<String> containsExpectation(String substring) {
return actual -> assertThat(actual).contains(substring);
}

private static Consumer<String> endsWithExpectation(String suffix) {
return actual -> assertThat(actual).endsWith(suffix);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void checkTokenNotAuthorized() {
t ->
assertThat(t)
.isInstanceOf(UaaException.class)
.hasMessage("access_denied: Access is denied"))
.hasMessageContainingAll("access_denied", "Access"))
.verify(Duration.ofMinutes(5));
}

Expand Down
Loading