|
16 | 16 | import org.elasticsearch.env.Environment; |
17 | 17 | import org.elasticsearch.env.TestEnvironment; |
18 | 18 | import org.elasticsearch.license.XPackLicenseState; |
19 | | - |
20 | 19 | import org.elasticsearch.xpack.core.security.action.oidc.OpenIdConnectLogoutResponse; |
21 | 20 | import org.elasticsearch.xpack.core.security.action.oidc.OpenIdConnectPrepareAuthenticationResponse; |
22 | 21 | import org.elasticsearch.xpack.core.security.authc.AuthenticationResult; |
|
31 | 30 | import org.junit.Before; |
32 | 31 |
|
33 | 32 | import java.util.Arrays; |
| 33 | +import java.util.Collection; |
34 | 34 | import java.util.Collections; |
35 | 35 | import java.util.Date; |
36 | 36 | import java.util.HashSet; |
|
43 | 43 | import static org.elasticsearch.xpack.core.security.authc.RealmSettings.getFullSettingKey; |
44 | 44 | import static org.elasticsearch.xpack.security.authc.oidc.OpenIdConnectRealm.CONTEXT_TOKEN_DATA; |
45 | 45 | import static org.hamcrest.Matchers.arrayContainingInAnyOrder; |
| 46 | +import static org.hamcrest.Matchers.contains; |
46 | 47 | import static org.hamcrest.Matchers.containsString; |
47 | 48 | import static org.hamcrest.Matchers.equalTo; |
48 | 49 | import static org.hamcrest.Matchers.instanceOf; |
@@ -91,6 +92,10 @@ public void testAuthentication() throws Exception { |
91 | 92 | } else { |
92 | 93 | assertThat(result.getUser().metadata().get("oidc(iss)"), equalTo("https://op.company.org")); |
93 | 94 | assertThat(result.getUser().metadata().get("oidc(name)"), equalTo("Clinton Barton")); |
| 95 | + final Object groups = result.getUser().metadata().get("oidc(groups)"); |
| 96 | + assertThat(groups, notNullValue()); |
| 97 | + assertThat(groups, instanceOf(Collection.class)); |
| 98 | + assertThat((Collection<?>) groups, contains("group1", "group2", "groups3")); |
94 | 99 | } |
95 | 100 | } |
96 | 101 |
|
|
0 commit comments