You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/08/22 10:22:16 UTC
[cxf] branch master updated: CXF-7806 - Add option to create JWT
access tokens without persisting them
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new d6b1025 CXF-7806 - Add option to create JWT access tokens without persisting them
d6b1025 is described below
commit d6b1025ea920f976ee3fc95eebd9b907de74c4a5
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Aug 22 09:17:50 2018 +0100
CXF-7806 - Add option to create JWT access tokens without persisting them
---
.../cxf/rs/security/oauth2/common/AccessToken.java | 11 ++
.../oauth2/provider/AbstractOAuthDataProvider.java | 21 ++-
.../services/AbstractAccessTokenValidator.java | 33 ++++-
.../oauth2/services/TokenIntrospectionService.java | 33 +++++
.../cxf/rs/security/oauth2/utils/OAuthUtils.java | 22 +--
.../security/oidc/idp/IdTokenResponseFilter.java | 3 +-
.../grants/AuthorizationGrantNegativeTest.java | 28 +++-
.../oauth2/grants/AuthorizationGrantTest.java | 52 +++++--
.../oauth2/grants/IntrospectionServiceTest.java | 30 +++-
.../security/oauth2/grants/JAXRSOAuth2Test.java | 28 +++-
.../systest/jaxrs/security/oidc/OIDCFlowTest.java | 60 ++++++--
.../jaxrs/security/oidc/OIDCNegativeTest.java | 30 +++-
.../systest/jaxrs/security/oidc/UserInfoTest.java | 34 ++++-
...nts-negative-server-jcache-jwt-non-persist.xml} | 139 ++++++-----------
.../grants-server-jcache-jwt-non-persist.xml} | 139 ++++++-----------
...ntrospection-server-jcache-jwt-non-persist.xml} | 130 +++++-----------
.../grants/server-jcache-jwt-non-persist.xml | 165 +++++++++++++++++++++
...idc-negative-server-jcache-jwt-non-persist.xml} | 114 +++++++-------
....xml => oidc-server-jcache-jwt-non-persist.xml} | 127 ++++++----------
... => userinfo-server-jcache-jwt-non-persist.xml} | 25 +++-
.../security/oidc/userinfo-server-jcache-jwt.xml | 4 +-
.../jaxrs/security/oidc/userinfo-server-jcache.xml | 4 +-
.../jaxrs/security/oidc/userinfo-server-jpa.xml | 4 +-
.../jaxrs/security/oidc/userinfo-server-jwt.xml | 4 +-
.../jaxrs/security/oidc/userinfo-server.xml | 4 +-
25 files changed, 764 insertions(+), 480 deletions(-)
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/AccessToken.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/AccessToken.java
index 241b47f..5bee11e 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/AccessToken.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/AccessToken.java
@@ -27,6 +27,7 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.MapKeyColumn;
import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
/**
* Base Access Token representation
@@ -42,6 +43,7 @@ public abstract class AccessToken implements Serializable {
private long expiresIn = -1;
private long issuedAt = -1;
private String issuer;
+ private String encodedToken;
private Map<String, String> parameters = new LinkedHashMap<String, String>();
@@ -159,4 +161,13 @@ public abstract class AccessToken implements Serializable {
public void setIssuer(String issuer) {
this.issuer = issuer;
}
+
+ @Transient
+ public String getEncodedToken() {
+ return encodedToken;
+ }
+
+ public void setEncodedToken(String encodedToken) {
+ this.encodedToken = encodedToken;
+ }
}
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
index 41289ed..c335cde 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
@@ -56,6 +56,7 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
private boolean supportPreauthorizedTokens;
private boolean useJwtFormatForAccessTokens;
+ private boolean persistJwtEncoding = true;
private OAuthJoseJwtProducer jwtAccessTokenProducer;
private Map<String, String> jwtAccessTokenClaimMap;
private ProviderAuthenticationStrategy authenticationStrategy;
@@ -100,7 +101,11 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
if (isUseJwtFormatForAccessTokens()) {
JwtClaims claims = createJwtAccessToken(at);
String jose = processJwtAccessToken(claims);
- at.setTokenKey(jose);
+ if (isPersistJwtEncoding()) {
+ at.setTokenKey(jose);
+ } else {
+ at.setEncodedToken(jose);
+ }
}
return at;
@@ -414,7 +419,11 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
if (isUseJwtFormatForAccessTokens()) {
JwtClaims claims = createJwtAccessToken(at);
String jose = processJwtAccessToken(claims);
- at.setTokenKey(jose);
+ if (isPersistJwtEncoding()) {
+ at.setTokenKey(jose);
+ } else {
+ at.setEncodedToken(jose);
+ }
}
return at;
@@ -642,4 +651,12 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
public void setJwtAccessTokenClaimMap(Map<String, String> jwtAccessTokenClaimMap) {
this.jwtAccessTokenClaimMap = jwtAccessTokenClaimMap;
}
+
+ public boolean isPersistJwtEncoding() {
+ return persistJwtEncoding;
+ }
+
+ public void setPersistJwtEncoding(boolean persistJwtEncoding) {
+ this.persistJwtEncoding = persistJwtEncoding;
+ }
}
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java
index 5ff56c7..5286d51 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java
@@ -31,6 +31,9 @@ import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.MessageContextImpl;
import org.apache.cxf.jaxrs.utils.ExceptionUtils;
import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer;
+import org.apache.cxf.rs.security.jose.jwt.JwtException;
+import org.apache.cxf.rs.security.jose.jwt.JwtToken;
import org.apache.cxf.rs.security.oauth2.common.AccessTokenValidation;
import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
import org.apache.cxf.rs.security.oauth2.provider.AccessTokenValidator;
@@ -55,6 +58,8 @@ public abstract class AbstractAccessTokenValidator {
private int maxValidationDataCacheSize;
private ConcurrentHashMap<String, AccessTokenValidation> accessTokenValidations =
new ConcurrentHashMap<String, AccessTokenValidation>();
+ private JoseJwtConsumer jwtTokenConsumer;
+ private boolean persistJwtEncoding = true;
public void setTokenValidator(AccessTokenValidator validator) {
setTokenValidators(Collections.singletonList(validator));
@@ -122,8 +127,16 @@ public abstract class AbstractAccessTokenValidator {
// Default processing if no registered providers available
if (accessTokenV == null && dataProvider != null && authScheme.equals(DEFAULT_AUTH_SCHEME)) {
try {
- localAccessToken = dataProvider.getAccessToken(authSchemeData);
- } catch (OAuthServiceException ex) {
+ String cacheKey = authSchemeData;
+ if (!persistJwtEncoding) {
+ JoseJwtConsumer theConsumer =
+ jwtTokenConsumer == null ? new JoseJwtConsumer() : jwtTokenConsumer;
+ JwtToken token = theConsumer.getJwtToken(authSchemeData);
+ cacheKey = token.getClaims().getTokenId();
+ }
+
+ localAccessToken = dataProvider.getAccessToken(cacheKey);
+ } catch (JwtException | OAuthServiceException ex) {
// to be handled next
}
if (localAccessToken == null) {
@@ -169,5 +182,21 @@ public abstract class AbstractAccessTokenValidator {
this.maxValidationDataCacheSize = maxValidationDataCacheSize;
}
+ public JoseJwtConsumer getJwtTokenConsumer() {
+ return jwtTokenConsumer;
+ }
+
+ public void setJwtTokenConsumer(JoseJwtConsumer jwtTokenConsumer) {
+ this.jwtTokenConsumer = jwtTokenConsumer;
+ }
+
+ public boolean isPersistJwtEncoding() {
+ return persistJwtEncoding;
+ }
+
+ public void setPersistJwtEncoding(boolean persistJwtEncoding) {
+ this.persistJwtEncoding = persistJwtEncoding;
+ }
+
}
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java
index 595b876..3fe5461 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java
@@ -34,6 +34,9 @@ import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.utils.ExceptionUtils;
+import org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer;
+import org.apache.cxf.rs.security.jose.jwt.JwtException;
+import org.apache.cxf.rs.security.jose.jwt.JwtToken;
import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
import org.apache.cxf.rs.security.oauth2.common.TokenIntrospection;
import org.apache.cxf.rs.security.oauth2.common.UserSubject;
@@ -49,12 +52,25 @@ public class TokenIntrospectionService {
private boolean reportExtraTokenProperties = true;
private MessageContext mc;
private OAuthDataProvider dataProvider;
+ private JoseJwtConsumer jwtTokenConsumer;
+ private boolean persistJwtEncoding = true;
+
@POST
@Produces({MediaType.APPLICATION_JSON })
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public TokenIntrospection getTokenIntrospection(@Encoded MultivaluedMap<String, String> params) {
checkSecurityContext();
String tokenId = params.getFirst(OAuthConstants.TOKEN_ID);
+ if (!persistJwtEncoding) {
+ try {
+ JoseJwtConsumer theConsumer = jwtTokenConsumer == null ? new JoseJwtConsumer() : jwtTokenConsumer;
+ JwtToken token = theConsumer.getJwtToken(tokenId);
+ tokenId = token.getClaims().getTokenId();
+ } catch (JwtException ex) {
+ return new TokenIntrospection(false);
+ }
+ }
+
ServerAccessToken at = dataProvider.getAccessToken(tokenId);
if (at == null || OAuthUtils.isExpired(at.getIssuedAt(), at.getExpiresIn())) {
return new TokenIntrospection(false);
@@ -125,4 +141,21 @@ public class TokenIntrospectionService {
public void setReportExtraTokenProperties(boolean reportExtraTokenProperties) {
this.reportExtraTokenProperties = reportExtraTokenProperties;
}
+
+ public JoseJwtConsumer getJwtTokenConsumer() {
+ return jwtTokenConsumer;
+ }
+
+ public void setJwtTokenConsumer(JoseJwtConsumer jwtTokenConsumer) {
+ this.jwtTokenConsumer = jwtTokenConsumer;
+ }
+
+ public boolean isPersistJwtEncoding() {
+ return persistJwtEncoding;
+ }
+
+ public void setPersistJwtEncoding(boolean persistJwtEncoding) {
+ this.persistJwtEncoding = persistJwtEncoding;
+ }
+
}
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
index 062689a..5162c1d 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
@@ -88,7 +88,7 @@ public final class OAuthUtils {
throw new OAuthServiceException(ex);
}
}
-
+
public static boolean compareCertificateThumbprints(X509Certificate cert, String encodedThumbprint) {
try {
byte[] thumbprint = createCertificateThumbprint(cert);
@@ -98,7 +98,7 @@ public final class OAuthUtils {
return false;
}
}
-
+
public static boolean compareTlsCertificates(TLSSessionInfo tlsInfo,
List<String> base64EncodedCerts) {
@@ -120,24 +120,24 @@ public final class OAuthUtils {
}
return false;
}
-
+
public static boolean isMutualTls(javax.ws.rs.core.SecurityContext sc, TLSSessionInfo tlsSessionInfo) {
// Pure 2-way TLS authentication
- return tlsSessionInfo != null
+ return tlsSessionInfo != null
&& StringUtils.isEmpty(sc.getAuthenticationScheme())
&& getRootTLSCertificate(tlsSessionInfo) != null;
}
-
+
public static String getSubjectDnFromTLSCertificates(X509Certificate cert) {
X500Principal x509Principal = cert.getSubjectX500Principal();
return x509Principal.getName();
}
-
+
public static String getIssuerDnFromTLSCertificates(X509Certificate cert) {
X500Principal x509Principal = cert.getIssuerX500Principal();
return x509Principal.getName();
}
-
+
public static X509Certificate getRootTLSCertificate(TLSSessionInfo tlsInfo) {
Certificate[] clientCerts = tlsInfo.getPeerCertificates();
if (clientCerts != null && clientCerts.length > 0) {
@@ -145,7 +145,7 @@ public final class OAuthUtils {
}
return null;
}
-
+
public static void injectContextIntoOAuthProvider(MessageContext context, Object provider) {
Method dataProviderContextMethod = null;
try {
@@ -162,7 +162,7 @@ public final class OAuthUtils {
}
}
}
-
+
public static String setSessionToken(MessageContext mc) {
return setSessionToken(mc, 0);
}
@@ -374,8 +374,10 @@ public final class OAuthUtils {
}
public static ClientAccessToken toClientAccessToken(ServerAccessToken serverToken, boolean supportOptionalParams) {
+ String tokenKey =
+ serverToken.getEncodedToken() != null ? serverToken.getEncodedToken() : serverToken.getTokenKey();
ClientAccessToken clientToken = new ClientAccessToken(serverToken.getTokenType(),
- serverToken.getTokenKey());
+ tokenKey);
clientToken.setRefreshToken(serverToken.getRefreshToken());
if (supportOptionalParams) {
clientToken.setExpiresIn(serverToken.getExpiresIn());
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
index 7a48f57..917b0ab 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/IdTokenResponseFilter.java
@@ -106,7 +106,8 @@ public class IdTokenResponseFilter extends OAuthServerJoseJwtProducer implements
}
if (sigAlgo != SignatureAlgorithm.NONE) {
if (atHashRequired) {
- String atHash = OidcUtils.calculateAccessTokenHash(st.getTokenKey(), sigAlgo);
+ String tokenKey = st.getEncodedToken() != null ? st.getEncodedToken() : st.getTokenKey();
+ String atHash = OidcUtils.calculateAccessTokenHash(tokenKey, sigAlgo);
idToken.setAccessTokenHash(atHash);
}
if (cHashRequired) {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
index 2495cde..66e8739 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
@@ -65,6 +65,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestBase {
@@ -78,6 +79,10 @@ public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestB
public static final String JWT_JCACHE_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-grants2-negative-jcache-jwt");
public static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-oauth2-grants-negative-jpa");
public static final String JPA_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-grants2-negative-jpa");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-oauth2-grants-negative-jcache-jwt-non-persist");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT2 =
+ TestUtil.getPortNumber("jaxrs-oauth2-grants2-negative-jcache-jwt-non-persist");
final String port;
@@ -97,6 +102,8 @@ public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestB
launchServer(BookServerOAuth2GrantsNegativeJCacheJWT.class, true));
assertTrue("server did not launch correctly",
launchServer(BookServerOAuth2GrantsNegativeJPA.class, true));
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerOAuth2GrantsNegativeJCacheJWTNonPersist.class, true));
}
@AfterClass
@@ -107,7 +114,7 @@ public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestB
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
//
@@ -1008,4 +1015,23 @@ public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestB
}
}
+
+ public static class BookServerOAuth2GrantsNegativeJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ BookServerOAuth2GrantsNegativeJWT.class.getResource("grants-negative-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new BookServerOAuth2GrantsNegativeJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
index 10c683a..a8c06ed 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
@@ -65,6 +65,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
@@ -78,6 +79,10 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
public static final String JWT_JCACHE_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-grants2-jcache-jwt");
public static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-oauth2-grants-jpa");
public static final String JPA_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-grants2-jpa");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-oauth2-grants-jcache-jwt-non-persist");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT2 =
+ TestUtil.getPortNumber("jaxrs-oauth2-grants2-jcache-jwt-non-persist");
final String port;
@@ -97,6 +102,8 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2GrantsJCacheJWT.class, true));
assertTrue("server did not launch correctly",
launchServer(BookServerOAuth2GrantsJPA.class, true));
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerOAuth2GrantsJCacheJWTNonPersist.class, true));
}
@AfterClass
@@ -107,7 +114,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@org.junit.Test
@@ -136,7 +143,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
OAuth2TestUtils.getAccessTokenWithAuthorizationCode(client, code);
assertNotNull(accessToken.getTokenKey());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -182,7 +189,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
OAuth2TestUtils.getAccessTokenWithAuthorizationCode(client, code);
assertNotNull(accessToken.getTokenKey());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -227,7 +234,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -273,7 +280,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -365,6 +372,8 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
audPort = JWT_JCACHE_PORT2;
} else if (JPA_PORT.equals(port)) {
audPort = JPA_PORT2;
+ } else if (JWT_NON_PERSIST_JCACHE_PORT.equals(port)) {
+ audPort = JWT_NON_PERSIST_JCACHE_PORT2;
}
String audience = "https://localhost:" + audPort + "/secured/bookstore/books";
ClientAccessToken accessToken =
@@ -410,7 +419,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
String accessToken = OAuth2TestUtils.getSubstring(location, "access_token");
assertNotNull(accessToken);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken);
}
}
@@ -438,7 +447,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -464,7 +473,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
// We don't have a Subject for the client credential grant,
// so validate manually here as opposed to calling validateAccessToken
JwsJwtCompactConsumer jwtConsumer = new JwsJwtCompactConsumer(accessToken.getTokenKey());
@@ -505,7 +514,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -536,7 +545,7 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertNotNull(accessToken.getTokenKey());
assertNotNull(accessToken.getRefreshToken());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -561,6 +570,10 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
SignatureAlgorithm.RS256));
}
+ private boolean isAccessTokenInJWTFormat() {
+ return JWT_PORT.equals(port) || JWT_JCACHE_PORT.equals(port) || JWT_NON_PERSIST_JCACHE_PORT.equals(port);
+ }
+
//
// Server implementations
//
@@ -659,4 +672,23 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
}
}
+
+ public static class BookServerOAuth2GrantsJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ BookServerOAuth2GrantsJCacheJWT.class.getResource("grants-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new BookServerOAuth2GrantsJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
index c8e30b6..6e44381 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
@@ -50,6 +50,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
@@ -64,6 +65,10 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
public static final String JWT_JCACHE_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-introspection2-jcache-jwt");
public static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-oauth2-introspection-jpa");
public static final String JPA_PORT2 = TestUtil.getPortNumber("jaxrs-oauth2-introspection2-jpa");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-oauth2-introspection-jcache-jwt-non-persist");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT2 =
+ TestUtil.getPortNumber("jaxrs-oauth2-introspection2-jcache-jwt-non-persist");
final String port;
@@ -83,6 +88,8 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2IntrospectionJCacheJWT.class, true));
assertTrue("server did not launch correctly",
launchServer(BookServerOAuth2IntrospectionJPA.class, true));
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerOAuth2IntrospectionJCacheJWTNonPersist.class, true));
}
@AfterClass
@@ -93,7 +100,7 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@org.junit.Test
@@ -170,6 +177,8 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
audPort = JWT_JCACHE_PORT2;
} else if (JPA_PORT.equals(port)) {
audPort = JPA_PORT2;
+ } else if (JWT_NON_PERSIST_JCACHE_PORT.equals(port)) {
+ audPort = JWT_NON_PERSIST_JCACHE_PORT2;
}
String audience = "https://localhost:" + audPort + "/secured/bookstore/books";
ClientAccessToken accessToken =
@@ -438,4 +447,23 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
}
}
+
+ public static class BookServerOAuth2IntrospectionJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ BookServerOAuth2IntrospectionJWT.class.getResource("introspection-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new BookServerOAuth2IntrospectionJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
index d06ffd2..5d65368 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
@@ -81,6 +81,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
@@ -94,6 +95,10 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
public static final String JWT_JCACHE_PORT_PUBLIC = TestUtil.getPortNumber("jaxrs-oauth2-public-jcache-jwt");
public static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-oauth2-jpa");
public static final String JPA_PORT_PUBLIC = TestUtil.getPortNumber("jaxrs-oauth2-public-jpa");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-oauth2-jcache-jwt-non-persist");
+ public static final String JWT_NON_PERSIST_JCACHE_PORT_PUBLIC =
+ TestUtil.getPortNumber("jaxrs-oauth2-public-jcache-jwt-non-persist");
private static final String CRYPTO_RESOURCE_PROPERTIES =
"org/apache/cxf/systest/jaxrs/security/alice.properties";
@@ -116,6 +121,8 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2JCacheJWT.class, true));
assertTrue("server did not launch correctly",
launchServer(BookServerOAuth2JPA.class, true));
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerOAuth2JCacheJWTNonPersist.class, true));
}
@AfterClass
@@ -126,7 +133,7 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@Test
@@ -735,4 +742,23 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
}
}
+
+ public static class BookServerOAuth2JCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ BookServerOAuth2Grants.class.getResource("server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new BookServerOAuth2JCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index eb98186..4637e44 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -72,6 +72,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class OIDCFlowTest extends AbstractBusClientServerTestBase {
@@ -81,6 +82,8 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
static final String JCACHE_PORT = TestUtil.getPortNumber("jaxrs-oidc-jcache");
static final String JWT_JCACHE_PORT = TestUtil.getPortNumber("jaxrs-oidc-jcache-jwt");
static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-oidc-jpa");
+ static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-oidc-jcache-jwt-non-persist");
final String port;
@@ -120,6 +123,12 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
// set this to false to fork
launchServer(OIDCServerJPA.class, true)
);
+ assertTrue(
+ "Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(OIDCServerJCacheJWTNonPersist.class, true)
+ );
}
@AfterClass
@@ -130,7 +139,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@org.junit.Test
@@ -165,7 +174,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNotNull(idToken);
validateIdToken(idToken, null);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -217,7 +226,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNotNull(idToken);
validateIdToken(idToken, null);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -253,7 +262,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNull(idToken);
assertFalse(accessToken.getApprovedScope().contains("openid"));
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -290,7 +299,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNotNull(idToken);
validateIdToken(idToken, "123456789");
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -327,7 +336,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNotNull(idToken);
validateIdToken(idToken, null);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -380,7 +389,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
accessToken.getParameters().get("id_token");
assertNotNull(idToken);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -417,7 +426,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertNotNull(idToken);
validateIdToken(idToken, null);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -450,7 +459,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
OAuth2TestUtils.getAccessTokenWithAuthorizationCode(client, code, "consumer-id-aud", audience);
assertNotNull(accessToken.getTokenKey());
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -514,7 +523,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.NONCE_CLAIM));
OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken);
}
}
@@ -583,7 +592,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.NONCE_CLAIM));
OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken);
}
}
@@ -704,7 +713,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
jwt = jwtConsumer.getJwtToken();
Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -767,7 +776,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
// returning c_hash in the id_token returned after exchanging the code is optional
Assert.assertNull(jwtConsumer.getJwtClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken.getTokenKey());
}
}
@@ -818,7 +827,7 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
OidcUtils.validateAccessTokenHash(accessToken, jwt, true);
Assert.assertNotNull(jwt.getClaims().getClaim(IdToken.AUTH_CODE_HASH_CLAIM));
- if (JWT_PORT.equals(port)) {
+ if (isAccessTokenInJWTFormat()) {
validateAccessToken(accessToken);
}
}
@@ -1006,6 +1015,10 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
SignatureAlgorithm.RS256));
}
+ private boolean isAccessTokenInJWTFormat() {
+ return JWT_PORT.equals(port) || JWT_JCACHE_PORT.equals(port) || JWT_NON_PERSIST_JCACHE_PORT.equals(port);
+ }
+
//
// Server implementations
//
@@ -1104,4 +1117,23 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
}
}
+
+ public static class OIDCServerJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ OIDCServerJWT.class.getResource("oidc-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new OIDCServerJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
index 781efe6..2980661 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
@@ -62,6 +62,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
@@ -71,6 +72,8 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
static final String JCACHE_PORT = TestUtil.getPortNumber("jaxrs-negative-oidc-jcache");
static final String JWT_JCACHE_PORT = TestUtil.getPortNumber("jaxrs-negative-oidc-jcache-jwt");
static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-negative-oidc-jpa");
+ static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-negative-oidc-jcache-jwt-non-persist");
final String port;
@@ -110,6 +113,12 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
// set this to false to fork
launchServer(OIDCNegativeServerJPA.class, true)
);
+ assertTrue(
+ "Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(OIDCNegativeServerJCacheJWTNonPersist.class, true)
+ );
}
@AfterClass
@@ -120,7 +129,7 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@org.junit.Test
@@ -549,4 +558,23 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
}
}
+
+ public static class OIDCNegativeServerJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ OIDCNegativeServerJWT.class.getResource("oidc-negative-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new OIDCNegativeServerJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
index 059a8a6..d4c466f 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
@@ -65,6 +65,7 @@ import org.junit.runners.Parameterized.Parameters;
* c) JCACHE_PORT - JCache
* d) JWT_JCACHE_PORT - JCache with useJwtFormatForAccessTokens enabled
* e) JPA_PORT - JPA provider
+ * f) JWT_NON_PERSIST_JCACHE_PORT- JCache with useJwtFormatForAccessTokens + !persistJwtEncoding
*/
@RunWith(value = org.junit.runners.Parameterized.class)
public class UserInfoTest extends AbstractBusClientServerTestBase {
@@ -74,6 +75,8 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
static final String JCACHE_PORT = TestUtil.getPortNumber("jaxrs-userinfo-jcache");
static final String JCACHE_JWT_PORT = TestUtil.getPortNumber("jaxrs-userinfo-jcache-jwt");
static final String JPA_PORT = TestUtil.getPortNumber("jaxrs-userinfo-jpa");
+ static final String JWT_NON_PERSIST_JCACHE_PORT =
+ TestUtil.getPortNumber("jaxrs-userinfo-jcache-jwt-non-persist");
final String port;
@@ -113,6 +116,12 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
// set this to false to fork
launchServer(UserInfoServerJPA.class, true)
);
+ assertTrue(
+ "Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(UserInfoServerJCacheJWTNonPersist.class, true)
+ );
}
@AfterClass
@@ -123,7 +132,7 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
@Parameters(name = "{0}")
public static Collection<String> data() {
- return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JCACHE_JWT_PORT, JPA_PORT);
+ return Arrays.asList(PORT, JWT_PORT, JCACHE_PORT, JCACHE_JWT_PORT, JPA_PORT, JWT_NON_PERSIST_JCACHE_PORT);
}
@org.junit.Test
@@ -282,11 +291,11 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
assertNotNull(token);
KeyStore keystore = KeyStore.getInstance("JKS");
- keystore.load(ClassLoaderUtils.getResourceAsStream("keys/bob.jks", this.getClass()),
+ keystore.load(ClassLoaderUtils.getResourceAsStream("keys/alice.jks", this.getClass()),
"password".toCharArray());
JweJwtCompactConsumer jwtConsumer = new JweJwtCompactConsumer(token);
- PrivateKey privateKey = (PrivateKey)keystore.getKey("bob", "password".toCharArray());
+ PrivateKey privateKey = (PrivateKey)keystore.getKey("alice", "password".toCharArray());
JwtToken jwt = jwtConsumer.decryptWith(privateKey);
assertEquals("alice", jwt.getClaim(JwtConstants.CLAIM_SUBJECT));
@@ -416,4 +425,23 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
}
}
+
+ public static class UserInfoServerJCacheJWTNonPersist extends AbstractBusTestServerBase {
+ private static final URL SERVER_CONFIG_FILE =
+ UserInfoServerJWT.class.getResource("userinfo-server-jcache-jwt-non-persist.xml");
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus springBus = bf.createBus(SERVER_CONFIG_FILE);
+ BusFactory.setDefaultBus(springBus);
+ setBus(springBus);
+
+ try {
+ new UserInfoServerJCacheJWTNonPersist();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
}
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-negative-server-jcache-jwt-non-persist.xml
similarity index 53%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-negative-server-jcache-jwt-non-persist.xml
index 295eb9e..05b0336 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-negative-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-oauth2-grants-negative-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -56,32 +56,64 @@ under the License.
<sec:trustManagers>
<sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
</sec:trustManagers>
- <sec:clientAuthentication want="false" required="false"/>
+ <sec:clientAuthentication want="true" required="true"/>
</httpj:tlsServerParameters>
<httpj:sessionSupport>true</httpj:sessionSupport>
</httpj:engine>
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-oauth2-grants2-negative-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
- <bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
+ <bean id="authorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>
- <bean id="idTokenProviderImpl" class="org.apache.cxf.systest.jaxrs.security.oidc.IdTokenProviderImpl"/>
-
- <bean id="idTokenFilter" class="org.apache.cxf.rs.security.oidc.idp.IdTokenResponseFilter">
- <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ <bean id="implicitService" class="org.apache.cxf.rs.security.oauth2.services.ImplicitGrantService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="refreshGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="callbackHandlerLoginHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.grants.CallbackHandlerLoginHandler">
+ <property name="callbackHandler" ref="callbackHandler"/>
+ </bean>
+
+ <bean id="passwordGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.owner.ResourceOwnerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="loginHandler" ref="callbackHandlerLoginHandler"/>
+ </bean>
+
+ <bean id="clientCredsGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.clientcred.ClientCredentialsGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="samlGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.saml.Saml2BearerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="jwtGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.jwt.JwtBearerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
</bean>
<bean id="tokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
<property name="dataProvider" ref="oauthProvider"/>
- <property name="responseFilter" ref="idTokenFilter"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="refreshGrantHandler"/>
+ <ref bean="passwordGrantHandler"/>
+ <ref bean="clientCredsGrantHandler"/>
+ <ref bean="samlGrantHandler"/>
+ <ref bean="jwtGrantHandler"/>
+ </list>
+ </property>
</bean>
-
+
<bean id="callbackHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.CallbackHandlerImpl"/>
<bean id="basicAuthFilter" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.WSS4JBasicAuthFilter">
<property name="callbackHandler" ref="callbackHandler"/>
@@ -89,15 +121,18 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-oauth2-grants-negative-jcache-jwt-non-persist}/services">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
+ <ref bean="implicitService"/>
<ref bean="tokenService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="basicAuthFilter"/>
</jaxrs:providers>
<jaxrs:properties>
+ <entry key="security.signature.properties"
+ value="org/apache/cxf/systest/jaxrs/security/bob.properties"/>
<entry key="rs.security.keystore.type" value="jks" />
<entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
@@ -107,87 +142,5 @@ under the License.
</jaxrs:properties>
</jaxrs:server>
- <bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
- <property name="dataProvider" ref="oauthProvider"/>
- </bean>
-
- <bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
- <bean id="userInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- </bean>
-
- <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider"/>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
- <jaxrs:serviceBeans>
- <ref bean="userInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- </jaxrs:server>
-
- <bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
- <jaxrs:serviceBeans>
- <ref bean="signedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="alice"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.key.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/alice.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
- </jaxrs:server>
-
- <bean id="encryptedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- <property name="jweRequired" value="true"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
- <jaxrs:serviceBeans>
- <ref bean="encryptedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
-
- </jaxrs:server>
-
- <http:conduit name="https://localhost.*">
- <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-
</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-server-jcache-jwt-non-persist.xml
similarity index 53%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-server-jcache-jwt-non-persist.xml
index 295eb9e..8965d9b 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/grants-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-oauth2-grants-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -56,32 +56,64 @@ under the License.
<sec:trustManagers>
<sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
</sec:trustManagers>
- <sec:clientAuthentication want="false" required="false"/>
+ <sec:clientAuthentication want="true" required="true"/>
</httpj:tlsServerParameters>
<httpj:sessionSupport>true</httpj:sessionSupport>
</httpj:engine>
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-oauth2-grants2-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
- <bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
+ <bean id="authorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>
- <bean id="idTokenProviderImpl" class="org.apache.cxf.systest.jaxrs.security.oidc.IdTokenProviderImpl"/>
-
- <bean id="idTokenFilter" class="org.apache.cxf.rs.security.oidc.idp.IdTokenResponseFilter">
- <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ <bean id="implicitService" class="org.apache.cxf.rs.security.oauth2.services.ImplicitGrantService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="refreshGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="callbackHandlerLoginHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.grants.CallbackHandlerLoginHandler">
+ <property name="callbackHandler" ref="callbackHandler"/>
+ </bean>
+
+ <bean id="passwordGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.owner.ResourceOwnerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="loginHandler" ref="callbackHandlerLoginHandler"/>
+ </bean>
+
+ <bean id="clientCredsGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.clientcred.ClientCredentialsGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="samlGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.saml.Saml2BearerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="jwtGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.jwt.JwtBearerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
</bean>
<bean id="tokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
<property name="dataProvider" ref="oauthProvider"/>
- <property name="responseFilter" ref="idTokenFilter"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="refreshGrantHandler"/>
+ <ref bean="passwordGrantHandler"/>
+ <ref bean="clientCredsGrantHandler"/>
+ <ref bean="samlGrantHandler"/>
+ <ref bean="jwtGrantHandler"/>
+ </list>
+ </property>
</bean>
-
+
<bean id="callbackHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.CallbackHandlerImpl"/>
<bean id="basicAuthFilter" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.WSS4JBasicAuthFilter">
<property name="callbackHandler" ref="callbackHandler"/>
@@ -89,15 +121,18 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-oauth2-grants-jcache-jwt-non-persist}/services">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
+ <ref bean="implicitService"/>
<ref bean="tokenService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="basicAuthFilter"/>
</jaxrs:providers>
<jaxrs:properties>
+ <entry key="security.signature.properties"
+ value="org/apache/cxf/systest/jaxrs/security/bob.properties"/>
<entry key="rs.security.keystore.type" value="jks" />
<entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
@@ -107,87 +142,5 @@ under the License.
</jaxrs:properties>
</jaxrs:server>
- <bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
- <property name="dataProvider" ref="oauthProvider"/>
- </bean>
-
- <bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
- <bean id="userInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- </bean>
-
- <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider"/>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
- <jaxrs:serviceBeans>
- <ref bean="userInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- </jaxrs:server>
-
- <bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
- <jaxrs:serviceBeans>
- <ref bean="signedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="alice"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.key.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/alice.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
- </jaxrs:server>
-
- <bean id="encryptedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- <property name="jweRequired" value="true"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
- <jaxrs:serviceBeans>
- <ref bean="encryptedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
-
- </jaxrs:server>
-
- <http:conduit name="https://localhost.*">
- <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-
</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/introspection-server-jcache-jwt-non-persist.xml
similarity index 54%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/introspection-server-jcache-jwt-non-persist.xml
index 295eb9e..e7660ac 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/introspection-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-oauth2-introspection-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -56,32 +56,55 @@ under the License.
<sec:trustManagers>
<sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
</sec:trustManagers>
- <sec:clientAuthentication want="false" required="false"/>
+ <sec:clientAuthentication want="true" required="true"/>
</httpj:tlsServerParameters>
<httpj:sessionSupport>true</httpj:sessionSupport>
</httpj:engine>
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-oauth2-introspection2-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
- <bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
+ <bean id="authorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>
- <bean id="idTokenProviderImpl" class="org.apache.cxf.systest.jaxrs.security.oidc.IdTokenProviderImpl"/>
-
- <bean id="idTokenFilter" class="org.apache.cxf.rs.security.oidc.idp.IdTokenResponseFilter">
- <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ <bean id="refreshGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
+ <bean id="callbackHandlerLoginHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.grants.CallbackHandlerLoginHandler">
+ <property name="callbackHandler" ref="callbackHandler"/>
+ </bean>
+
+ <bean id="passwordGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.owner.ResourceOwnerGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="loginHandler" ref="callbackHandlerLoginHandler"/>
+ </bean>
+
+ <bean id="clientCredsGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.clientcred.ClientCredentialsGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
</bean>
<bean id="tokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
<property name="dataProvider" ref="oauthProvider"/>
- <property name="responseFilter" ref="idTokenFilter"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="refreshGrantHandler"/>
+ <ref bean="passwordGrantHandler"/>
+ <ref bean="clientCredsGrantHandler"/>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="tokenIntrospectionService" class="org.apache.cxf.rs.security.oauth2.services.TokenIntrospectionService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
-
+
<bean id="callbackHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.CallbackHandlerImpl"/>
<bean id="basicAuthFilter" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.WSS4JBasicAuthFilter">
<property name="callbackHandler" ref="callbackHandler"/>
@@ -89,15 +112,18 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-oauth2-introspection-jcache-jwt-non-persist}/services">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
<ref bean="tokenService"/>
+ <ref bean="tokenIntrospectionService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="basicAuthFilter"/>
</jaxrs:providers>
<jaxrs:properties>
+ <entry key="security.signature.properties"
+ value="org/apache/cxf/systest/jaxrs/security/bob.properties"/>
<entry key="rs.security.keystore.type" value="jks" />
<entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
@@ -107,87 +133,5 @@ under the License.
</jaxrs:properties>
</jaxrs:server>
- <bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
- <property name="dataProvider" ref="oauthProvider"/>
- </bean>
-
- <bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
- <bean id="userInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- </bean>
-
- <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider"/>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
- <jaxrs:serviceBeans>
- <ref bean="userInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- </jaxrs:server>
-
- <bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
- <jaxrs:serviceBeans>
- <ref bean="signedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="alice"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.key.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/alice.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
- </jaxrs:server>
-
- <bean id="encryptedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- <property name="jweRequired" value="true"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
- <jaxrs:serviceBeans>
- <ref bean="encryptedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
-
- </jaxrs:server>
-
- <http:conduit name="https://localhost.*">
- <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-
</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/server-jcache-jwt-non-persist.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/server-jcache-jwt-non-persist.xml
new file mode 100644
index 0000000..9e01ba7
--- /dev/null
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oauth2/grants/server-jcache-jwt-non-persist.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+ xmlns:sec="http://cxf.apache.org/configuration/security"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+ http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ <cxf:properties>
+ <entry key="org.apache.cxf.jaxrs.bus.providers" value-ref="busProviders"/>
+ </cxf:properties>
+ </cxf:bus>
+ <!-- providers -->
+ <util:list id="busProviders">
+ <ref bean="oauthJson"/>
+ </util:list>
+ <httpj:engine-factory id="port-9095-tls-config">
+ <httpj:engine port="${testutil.ports.jaxrs-oauth2-jcache-jwt-non-persist}">
+ <httpj:tlsServerParameters>
+ <sec:keyManagers keyPassword="password">
+ <sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
+ </sec:keyManagers>
+ <sec:trustManagers>
+ <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
+ </sec:trustManagers>
+ <sec:clientAuthentication want="true" required="true"/>
+ </httpj:tlsServerParameters>
+ </httpj:engine>
+ </httpj:engine-factory>
+ <bean id="dataProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
+ <constructor-arg><value>12345</value></constructor-arg>
+ <property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
+ </bean>
+ <bean id="samlGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.saml.Saml2BearerGrantHandler">
+ <property name="dataProvider" ref="dataProvider"/>
+ </bean>
+ <bean id="jwtGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.jwt.JwtBearerGrantHandler">
+ <property name="dataProvider" ref="dataProvider"/>
+ </bean>
+
+ <bean id="samlAuthHandler" class="org.apache.cxf.rs.security.oauth2.auth.saml.Saml2BearerAuthHandler"/>
+ <bean id="jwtAuthHandler" class="org.apache.cxf.rs.security.oauth2.grants.jwt.JwtBearerAuthHandler"/>
+
+ <bean id="customGrantHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.grants.CustomGrantHandler">
+ <property name="dataProvider" ref="dataProvider"/>
+ </bean>
+ <bean id="clientCredGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.clientcred.ClientCredentialsGrantHandler">
+ <property name="dataProvider" ref="dataProvider"/>
+ </bean>
+ <bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
+ <bean id="serviceBean" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
+ <property name="dataProvider" ref="dataProvider"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="samlGrantHandler"/>
+ <ref bean="jwtGrantHandler"/>
+ <ref bean="customGrantHandler"/>
+ <ref bean="clientCredGrantHandler"/>
+ </list>
+ </property>
+ <property name="canSupportPublicClients" value="true"/>
+ </bean>
+ <bean id="serviceBeanPublic" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
+ <property name="dataProvider" ref="dataProvider"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="customGrantHandler"/>
+ </list>
+ </property>
+ <property name="canSupportPublicClients" value="true"/>
+ </bean>
+ <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-oauth2-jcache-jwt-non-persist}/oauth2">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:properties>
+ <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/alice.properties"/>
+ <entry key="rs.security.keystore.type" value="jks" />
+ <entry key="rs.security.keystore.alias" value="alice"/>
+ <entry key="rs.security.keystore.password" value="password"/>
+ <entry key="rs.security.key.password" value="password"/>
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
+ <entry key="rs.security.signature.algorithm" value="RS256" />
+ </jaxrs:properties>
+ </jaxrs:server>
+ <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-oauth2-public-jcache-jwt-non-persist}/oauth2Public">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBeanPublic"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:properties>
+ <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/alice.properties"/>
+ <entry key="rs.security.keystore.type" value="jks" />
+ <entry key="rs.security.keystore.alias" value="alice"/>
+ <entry key="rs.security.keystore.password" value="password"/>
+ <entry key="rs.security.key.password" value="password"/>
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
+ <entry key="rs.security.signature.algorithm" value="RS256" />
+ </jaxrs:properties>
+ </jaxrs:server>
+ <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-oauth2-jcache-jwt-non-persist}/oauth2-auth">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="samlAuthHandler"/>
+ </jaxrs:providers>
+ <jaxrs:properties>
+ <entry key="security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/alice.properties"/>
+ <entry key="rs.security.keystore.type" value="jks" />
+ <entry key="rs.security.keystore.alias" value="alice"/>
+ <entry key="rs.security.keystore.password" value="password"/>
+ <entry key="rs.security.key.password" value="password"/>
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
+ <entry key="rs.security.signature.algorithm" value="RS256" />
+ </jaxrs:properties>
+ </jaxrs:server>
+ <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-oauth2-jcache-jwt-non-persist}/oauth2-auth-jwt">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="jwtAuthHandler"/>
+ </jaxrs:providers>
+ <jaxrs:properties>
+ <entry key="rs.security.keystore.type" value="jks" />
+ <entry key="rs.security.keystore.alias" value="alice"/>
+ <entry key="rs.security.keystore.password" value="password"/>
+ <entry key="rs.security.key.password" value="password"/>
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
+ <entry key="rs.security.signature.algorithm" value="RS256" />
+ </jaxrs:properties>
+ </jaxrs:server>
+</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-negative-server-jcache-jwt-non-persist.xml
similarity index 71%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-negative-server-jcache-jwt-non-persist.xml
index 295eb9e..e67afd5 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-negative-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-negative-oidc-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -63,14 +63,25 @@ under the License.
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-negative-oidc-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
<bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>
+ <bean id="implicitService" class="org.apache.cxf.rs.security.oidc.idp.OidcImplicitService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="responseFilter" ref="idTokenFilter"/>
+ <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ </bean>
+
+ <bean id="refreshGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
<bean id="idTokenProviderImpl" class="org.apache.cxf.systest.jaxrs.security.oidc.IdTokenProviderImpl"/>
<bean id="idTokenFilter" class="org.apache.cxf.rs.security.oidc.idp.IdTokenResponseFilter">
@@ -79,23 +90,41 @@ under the License.
<bean id="tokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
<property name="dataProvider" ref="oauthProvider"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="refreshGrantHandler"/>
+ </list>
+ </property>
+ <property name="responseFilter" ref="idTokenFilter"/>
+ </bean>
+
+ <bean id="hybridService" class="org.apache.cxf.rs.security.oidc.idp.OidcHybridService">
+ <property name="dataProvider" ref="oauthProvider"/>
<property name="responseFilter" ref="idTokenFilter"/>
+ <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ <property name="codeService" ref="authorizationService"/>
</bean>
-
+
<bean id="callbackHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.CallbackHandlerImpl"/>
<bean id="basicAuthFilter" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.WSS4JBasicAuthFilter">
<property name="callbackHandler" ref="callbackHandler"/>
</bean>
+ <bean id="oidcKeysService" class="org.apache.cxf.rs.security.oidc.idp.OidcKeysService"/>
+
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-negative-oidc-jcache-jwt-non-persist}/services">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
+ <ref bean="hybridService"/>
+ <ref bean="implicitService"/>
<ref bean="tokenService"/>
+ <ref bean="oidcKeysService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="basicAuthFilter"/>
+ <bean class="org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider"/>
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
@@ -107,11 +136,34 @@ under the License.
</jaxrs:properties>
</jaxrs:server>
+ <bean id="jwtRequestFilter" class="org.apache.cxf.rs.security.oauth2.grants.code.JwtRequestCodeFilter"/>
+
+ <bean id="jwtAuthorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="authorizationFilter" ref="jwtRequestFilter"/>
+ </bean>
+
+ <jaxrs:server
+ depends-on="tls-config"
+ address="https://localhost:${testutil.ports.jaxrs-negative-oidc-jcache-jwt-non-persist}/unsignedjwtservices">
+ <jaxrs:serviceBeans>
+ <ref bean="jwtAuthorizationService"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="basicAuthFilter"/>
+ </jaxrs:providers>
+ <jaxrs:properties>
+ <entry key="rs.security.signature.algorithm" value="none" />
+ </jaxrs:properties>
+ </jaxrs:server>
+
<bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
<property name="dataProvider" ref="oauthProvider"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
<bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
+
<bean id="userInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
<property name="userInfoProvider" ref="userInfoProvider"/>
<property name="jwsRequired" value="false"/>
@@ -121,7 +173,7 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
+ address="https://localhost:${testutil.ports.jaxrs-negative-oidc-jcache-jwt-non-persist}/ui/plain">
<jaxrs:serviceBeans>
<ref bean="userInfoService"/>
</jaxrs:serviceBeans>
@@ -129,65 +181,13 @@ under the License.
<ref bean="oAuthFilter"/>
<ref bean="jsonProvider"/>
</jaxrs:providers>
- </jaxrs:server>
-
- <bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
- <jaxrs:serviceBeans>
- <ref bean="signedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
<entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.key.password" value="password"/>
<entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
</jaxrs:server>
-
- <bean id="encryptedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- <property name="jweRequired" value="true"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
- <jaxrs:serviceBeans>
- <ref bean="encryptedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
-
- </jaxrs:server>
-
- <http:conduit name="https://localhost.*">
- <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-
</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-server-jcache-jwt-non-persist.xml
similarity index 59%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-server-jcache-jwt-non-persist.xml
index 295eb9e..7c99156 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/oidc-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-oidc-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -63,14 +63,25 @@ under the License.
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-oidc-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
<bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>
+ <bean id="implicitService" class="org.apache.cxf.rs.security.oidc.idp.OidcImplicitService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="responseFilter" ref="idTokenFilter"/>
+ <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ </bean>
+
+ <bean id="refreshGrantHandler" class="org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrantHandler">
+ <property name="dataProvider" ref="oauthProvider"/>
+ </bean>
+
<bean id="idTokenProviderImpl" class="org.apache.cxf.systest.jaxrs.security.oidc.IdTokenProviderImpl"/>
<bean id="idTokenFilter" class="org.apache.cxf.rs.security.oidc.idp.IdTokenResponseFilter">
@@ -79,23 +90,41 @@ under the License.
<bean id="tokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
<property name="dataProvider" ref="oauthProvider"/>
+ <property name="grantHandlers">
+ <list>
+ <ref bean="refreshGrantHandler"/>
+ </list>
+ </property>
+ <property name="responseFilter" ref="idTokenFilter"/>
+ </bean>
+
+ <bean id="hybridService" class="org.apache.cxf.rs.security.oidc.idp.OidcHybridService">
+ <property name="dataProvider" ref="oauthProvider"/>
<property name="responseFilter" ref="idTokenFilter"/>
+ <property name="idTokenProvider" ref="idTokenProviderImpl"/>
+ <property name="codeService" ref="authorizationService"/>
</bean>
-
+
<bean id="callbackHandler" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.CallbackHandlerImpl"/>
<bean id="basicAuthFilter" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.WSS4JBasicAuthFilter">
<property name="callbackHandler" ref="callbackHandler"/>
</bean>
+ <bean id="oidcKeysService" class="org.apache.cxf.rs.security.oidc.idp.OidcKeysService"/>
+
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-oidc-jcache-jwt-non-persist}/services">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
+ <ref bean="hybridService"/>
+ <ref bean="implicitService"/>
<ref bean="tokenService"/>
+ <ref bean="oidcKeysService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="basicAuthFilter"/>
+ <bean class="org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider"/>
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
@@ -107,87 +136,25 @@ under the License.
</jaxrs:properties>
</jaxrs:server>
- <bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
- <property name="dataProvider" ref="oauthProvider"/>
- </bean>
-
- <bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
- <bean id="userInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- </bean>
-
- <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider"/>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
- <jaxrs:serviceBeans>
- <ref bean="userInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- </jaxrs:server>
-
- <bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- </bean>
-
- <jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
- <jaxrs:serviceBeans>
- <ref bean="signedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- <ref bean="jsonProvider"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="alice"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.key.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/alice.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
- </jaxrs:properties>
- </jaxrs:server>
+ <bean id="jwtRequestFilter" class="org.apache.cxf.rs.security.oauth2.grants.code.JwtRequestCodeFilter"/>
- <bean id="encryptedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
- <property name="userInfoProvider" ref="userInfoProvider"/>
- <property name="jwsRequired" value="false"/>
- <property name="jweRequired" value="true"/>
+ <bean id="jwtAuthorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
+ <property name="dataProvider" ref="oauthProvider"/>
+ <property name="authorizationFilter" ref="jwtRequestFilter"/>
</bean>
<jaxrs:server
- depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
- <jaxrs:serviceBeans>
- <ref bean="encryptedUserInfoService"/>
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="oAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:properties>
- <entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
- <entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
- <entry key="rs.security.signature.algorithm" value="RS256" />
+ depends-on="tls-config"
+ address="https://localhost:${testutil.ports.jaxrs-oidc-jcache-jwt-non-persist}/unsignedjwtservices">
+ <jaxrs:serviceBeans>
+ <ref bean="jwtAuthorizationService"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="basicAuthFilter"/>
+ </jaxrs:providers>
+ <jaxrs:properties>
+ <entry key="rs.security.signature.algorithm" value="none" />
</jaxrs:properties>
-
</jaxrs:server>
-
- <http:conduit name="https://localhost.*">
- <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="JKS" password="password" resource="keys/Truststore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-
</beans>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt-non-persist.xml
similarity index 90%
copy from systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
copy to systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt-non-persist.xml
index 295eb9e..cbcfb16 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt-non-persist.xml
@@ -48,7 +48,7 @@ under the License.
<bean id="oauthJson" class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
<httpj:engine-factory id="tls-config">
- <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt}">
+ <httpj:engine port="${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password" resource="keys/Bethal.jks"/>
@@ -63,8 +63,9 @@ under the License.
</httpj:engine-factory>
<bean id="oauthProvider" class="org.apache.cxf.systest.jaxrs.security.oauth2.common.JCacheOAuthDataProviderImpl">
- <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt}</value></constructor-arg>
+ <constructor-arg><value>${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}</value></constructor-arg>
<property name="useJwtFormatForAccessTokens" value="true"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
<bean id="authorizationService" class="org.apache.cxf.rs.security.oidc.idp.OidcAuthorizationCodeService">
@@ -89,7 +90,7 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/oidc">
+ address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}/services/oidc">
<jaxrs:serviceBeans>
<ref bean="authorizationService"/>
<ref bean="tokenService"/>
@@ -109,6 +110,7 @@ under the License.
<bean id="oAuthFilter" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
<property name="dataProvider" ref="oauthProvider"/>
+ <property name="persistJwtEncoding" value="false"/>
</bean>
<bean id="userInfoProvider" class="org.apache.cxf.systest.jaxrs.security.oidc.UserInfoProviderImpl" />
@@ -121,7 +123,7 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/plain">
+ address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}/services/plain">
<jaxrs:serviceBeans>
<ref bean="userInfoService"/>
</jaxrs:serviceBeans>
@@ -129,6 +131,13 @@ under the License.
<ref bean="oAuthFilter"/>
<ref bean="jsonProvider"/>
</jaxrs:providers>
+ <jaxrs:properties>
+ <entry key="rs.security.keystore.type" value="jks" />
+ <entry key="rs.security.keystore.alias" value="alice"/>
+ <entry key="rs.security.keystore.password" value="password"/>
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
+ <entry key="rs.security.signature.algorithm" value="RS256" />
+ </jaxrs:properties>
</jaxrs:server>
<bean id="signedUserInfoService" class="org.apache.cxf.rs.security.oidc.idp.UserInfoService">
@@ -137,7 +146,7 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/signed">
+ address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}/services/signed">
<jaxrs:serviceBeans>
<ref bean="signedUserInfoService"/>
</jaxrs:serviceBeans>
@@ -163,7 +172,7 @@ under the License.
<jaxrs:server
depends-on="tls-config"
- address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt}/services/encrypted">
+ address="https://localhost:${testutil.ports.jaxrs-userinfo-jcache-jwt-non-persist}/services/encrypted">
<jaxrs:serviceBeans>
<ref bean="encryptedUserInfoService"/>
</jaxrs:serviceBeans>
@@ -172,9 +181,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
index 295eb9e..452d429 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache-jwt.xml
@@ -172,9 +172,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache.xml
index 912b7bf..2d76385 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jcache.xml
@@ -171,9 +171,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jpa.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jpa.xml
index 387f2f8..b96dce6 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jpa.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jpa.xml
@@ -184,9 +184,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jwt.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jwt.xml
index e243f03..fa5eeb0 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jwt.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server-jwt.xml
@@ -172,9 +172,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server.xml b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server.xml
index 4b041b0..8d017f1 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/oidc/userinfo-server.xml
@@ -171,9 +171,9 @@ under the License.
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
- <entry key="rs.security.keystore.alias" value="bob"/>
+ <entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
- <entry key="rs.security.keystore.file" value="keys/bob.jks" />
+ <entry key="rs.security.keystore.file" value="keys/alice.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>