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/04/03 16:21:22 UTC
[cxf] branch master updated (82fc4f0 -> 9a90413)
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.
from 82fc4f0 CXF-7634: Enrich support for Swagger Core 2.0 (OpenApi Spec 3.0). Adding OSGi support and samples
new ad579cd Removing BouncyCastle where it's not needed in a couple of testsd
new 9a90413 CXF-7693 - Allow JWT aud claim to be empty
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/cxf/rs/security/jose/jwt/JwtClaims.java | 2 +-
.../org/apache/cxf/rs/security/jose/jwt/JwtUtils.java | 16 ++++++++--------
.../jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java | 14 --------------
.../jaxrs/security/jose/jwt/JWTPropertiesTest.java | 16 +---------------
4 files changed, 10 insertions(+), 38 deletions(-)
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.
[cxf] 01/02: Removing BouncyCastle where it's not needed in a
couple of testsd
Posted by co...@apache.org.
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
commit ad579cdefe5ec49066ebc9d41db6c7b79eceb2c4
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Apr 3 15:36:35 2018 +0100
Removing BouncyCastle where it's not needed in a couple of testsd
---
.../systest/jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java | 14 --------------
.../systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java | 14 --------------
2 files changed, 28 deletions(-)
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java
index 4d3c2f4..50367e7 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTAuthnAuthzTest.java
@@ -20,7 +20,6 @@
package org.apache.cxf.systest.jaxrs.security.jose.jwt;
import java.net.URL;
-import java.security.Security;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
@@ -39,9 +38,7 @@ import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
import org.apache.cxf.rs.security.jose.jwt.JwtToken;
import org.apache.cxf.systest.jaxrs.security.Book;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
@@ -54,17 +51,6 @@ public class JWTAuthnAuthzTest extends AbstractBusClientServerTestBase {
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
launchServer(BookServerJwtAuthnAuthz.class, true));
- registerBouncyCastleIfNeeded();
- }
-
- private static void registerBouncyCastleIfNeeded() throws Exception {
- // Still need it for Oracle Java 7 and Java 8
- Security.addProvider(new BouncyCastleProvider());
- }
-
- @AfterClass
- public static void unregisterBouncyCastleIfNeeded() throws Exception {
- Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}
@org.junit.Test
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
index cf2f1a8..81e892c 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
@@ -20,7 +20,6 @@
package org.apache.cxf.systest.jaxrs.security.jose.jwt;
import java.net.URL;
-import java.security.Security;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
@@ -40,9 +39,7 @@ import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
import org.apache.cxf.rs.security.jose.jwt.JwtToken;
import org.apache.cxf.systest.jaxrs.security.Book;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
@@ -55,17 +52,6 @@ public class JWTPropertiesTest extends AbstractBusClientServerTestBase {
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
launchServer(BookServerJwtProperties.class, true));
- registerBouncyCastleIfNeeded();
- }
-
- private static void registerBouncyCastleIfNeeded() throws Exception {
- // Still need it for Oracle Java 7 and Java 8
- Security.addProvider(new BouncyCastleProvider());
- }
-
- @AfterClass
- public static void unregisterBouncyCastleIfNeeded() throws Exception {
- Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}
@org.junit.Test
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.
[cxf] 02/02: CXF-7693 - Allow JWT aud claim to be empty
Posted by co...@apache.org.
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
commit 9a90413fff82236806ae42c045ac7f3256f8f224
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Apr 3 17:20:38 2018 +0100
CXF-7693 - Allow JWT aud claim to be empty
---
.../org/apache/cxf/rs/security/jose/jwt/JwtClaims.java | 2 +-
.../org/apache/cxf/rs/security/jose/jwt/JwtUtils.java | 16 ++++++++--------
.../jaxrs/security/jose/jwt/JWTPropertiesTest.java | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
index 7488f74..92d0374 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
@@ -98,7 +98,7 @@ public class JwtClaims extends JsonMapObject {
return Collections.singletonList((String)audiences);
}
- return null;
+ return Collections.emptyList();
}
public void setExpiryTime(Long expiresIn) {
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
index 9ea3904..9342cba 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
@@ -90,12 +90,12 @@ public final class JwtUtils {
}
Instant createdDate = Instant.ofEpochMilli(issuedAtInSecs * 1000L);
-
+
Instant validCreation = Instant.now();
if (clockOffset != 0) {
validCreation = validCreation.plusSeconds(clockOffset);
}
-
+
// Check to see if the IssuedAt time is in the future
if (createdDate.isAfter(validCreation)) {
throw new JwtException("Invalid issuedAt");
@@ -113,17 +113,17 @@ public final class JwtUtils {
}
public static void validateJwtAudienceRestriction(JwtClaims claims, Message message) {
+ if (claims.getAudiences().isEmpty()) {
+ return;
+ }
+
String expectedAudience = (String)message.getContextualProperty(JwtConstants.EXPECTED_CLAIM_AUDIENCE);
if (expectedAudience == null) {
expectedAudience = (String)message.getContextualProperty(Message.REQUEST_URL);
}
- if (expectedAudience != null) {
- for (String audience : claims.getAudiences()) {
- if (expectedAudience.equals(audience)) {
- return;
- }
- }
+ if (expectedAudience != null && claims.getAudiences().contains(expectedAudience)) {
+ return;
}
throw new JwtException("Invalid audience restriction");
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
index 81e892c..7466333 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwt/JWTPropertiesTest.java
@@ -357,7 +357,7 @@ public class JWTPropertiesTest extends AbstractBusClientServerTestBase {
WebClient.getConfig(client).getRequestContext().putAll(properties);
Response response = client.post(new Book("book", 123L));
- assertNotEquals(response.getStatus(), 200);
+ assertEquals(response.getStatus(), 200);
}
@org.junit.Test
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.