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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 0 additions & 117 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
21 changes: 19 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
# 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.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private static Optional<Claims> parseToken(String token) {

try {
String jws = token.substring(0, token.lastIndexOf('.') + 1);
JwtParser parser = Jwts.parserBuilder().build();
JwtParser parser = Jwts.parser().build();

return Optional.of(parser.parseClaimsJwt(jws).getBody());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public Key resolveSigningKey(JwsHeader header, Claims claims) {

@Override
@SuppressWarnings("rawtypes")
public Key resolveSigningKey(JwsHeader header, String plaintext) {
return getKey(header.getKeyId());
public Key resolveSigningKey(JwsHeader jwsHeader, byte[] bytes) {
return getKey(jwsHeader.getKeyId());
}

private static byte[] decode(TokenKey tokenKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ private static Mono<String> getToken(
}

private String getUsername(String token) {
JwtParser parser =
Jwts.parserBuilder().setSigningKeyResolver(this.signingKeyResolver).build();
JwtParser parser = Jwts.parser().setSigningKeyResolver(this.signingKeyResolver).build();

Jws<Claims> jws = parser.parseClaimsJws(token);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.Collections;
import org.cloudfoundry.client.v3.LifecycleType;
import org.cloudfoundry.client.v3.Link;
import org.cloudfoundry.client.v3.Metadata;
import org.cloudfoundry.client.v3.Pagination;
Expand Down Expand Up @@ -99,6 +100,7 @@ void create() {
.position(42)
.enabled(true)
.locked(false)
.lifecycle(LifecycleType.BUILDPACK)
.metadata(
Metadata.builder()
.annotations(Collections.emptyMap())
Expand Down Expand Up @@ -179,6 +181,7 @@ void get() {
.position(42)
.enabled(true)
.locked(false)
.lifecycle(LifecycleType.BUILDPACK)
.metadata(
Metadata.builder()
.annotations(Collections.emptyMap())
Expand Down Expand Up @@ -250,6 +253,7 @@ void list() {
.position(1)
.enabled(true)
.locked(false)
.lifecycle(LifecycleType.BUILDPACK)
.metadata(
Metadata.builder()
.annotations(Collections.emptyMap())
Expand Down Expand Up @@ -315,6 +319,7 @@ void update() {
.position(42)
.enabled(true)
.locked(false)
.lifecycle(LifecycleType.BUILDPACK)
.metadata(
Metadata.builder()
.annotations(Collections.emptyMap())
Expand Down Expand Up @@ -407,6 +412,7 @@ void upload() throws IOException {
.position(42)
.enabled(true)
.locked(false)
.lifecycle(LifecycleType.BUILDPACK)
.metadata(
Metadata.builder()
.annotations(Collections.emptyMap())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
import static org.mockito.Mockito.when;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwsHeader;
import io.jsonwebtoken.impl.DefaultClaims;
import io.jsonwebtoken.impl.DefaultJwsHeader;
import io.jsonwebtoken.impl.security.AbstractJwk;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.util.Base64;
import java.util.HashMap;
import org.cloudfoundry.uaa.tokens.KeyType;
import org.cloudfoundry.uaa.tokens.ListTokenKeysRequest;
import org.cloudfoundry.uaa.tokens.ListTokenKeysResponse;
Expand Down Expand Up @@ -64,8 +65,10 @@ void resolveExistingKey() throws NoSuchAlgorithmException {
.build())
.build()));

JwsHeader<?> header = new DefaultJwsHeader().setKeyId("test-key-id");
Claims claims = new DefaultClaims();
HashMap<String, String> params = new HashMap<>();
params.put(AbstractJwk.KID.getId(), "test-key-id");
DefaultJwsHeader header = new DefaultJwsHeader(params);
Claims claims = new DefaultClaims(new HashMap<>());

this.signingKeyResolver.resolveSigningKey(header, claims);
assertThat(this.signingKeyResolver.resolveSigningKey(header, claims)).isNotNull();
Expand All @@ -91,8 +94,10 @@ void resolveRefreshedKey() throws NoSuchAlgorithmException {
.build())
.build()));

JwsHeader<?> header = new DefaultJwsHeader().setKeyId("test-key-id");
Claims claims = new DefaultClaims();
HashMap<String, String> params = new HashMap<>();
params.put(AbstractJwk.KID.getId(), "test-key-id");
DefaultJwsHeader header = new DefaultJwsHeader(params);
Claims claims = new DefaultClaims(new HashMap<>());

assertThat(this.signingKeyResolver.resolveSigningKey(header, claims)).isNotNull();
}
Expand All @@ -105,8 +110,10 @@ void resolveUnknownKey() {
when(this.tokens.listKeys(ListTokenKeysRequest.builder().build()))
.thenReturn(Mono.just(ListTokenKeysResponse.builder().build()));

JwsHeader<?> header = new DefaultJwsHeader().setKeyId("test-key-id");
Claims claims = new DefaultClaims();
HashMap<String, String> params = new HashMap<>();
params.put(AbstractJwk.KID.getId(), "test-key-id");
DefaultJwsHeader header = new DefaultJwsHeader(params);
Claims claims = new DefaultClaims(new HashMap<>());

this.signingKeyResolver.resolveSigningKey(header, claims);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SigningKeyResolver;
import io.jsonwebtoken.impl.DefaultJwsHeader;
import io.jsonwebtoken.impl.security.AbstractJwk;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.sql.Date;
import java.time.Duration;
import java.time.Instant;
import java.util.Map;
import java.util.HashMap;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -103,8 +104,11 @@ void getValidToken() throws NoSuchAlgorithmException {

@SuppressWarnings("unchecked")
private static String getToken(PrivateKey privateKey, Instant expiration) {
HashMap<String, String> params = new HashMap<>();
params.put(AbstractJwk.KID.getId(), "test-key-id");
DefaultJwsHeader header = new DefaultJwsHeader(params);
return Jwts.builder()
.setHeader((Map<String, Object>) new DefaultJwsHeader().setKeyId("test-key"))
.setHeader(header)
.signWith(privateKey, SignatureAlgorithm.RS256)
.claim("user_name", "test-username")
.setExpiration(Date.from(expiration))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"position": 1,
"enabled": true,
"locked": false,
"lifecycle": "buildpack",
"metadata": {
"labels": {},
"annotations": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"position": 42,
"enabled": true,
"locked": false,
"lifecycle": "buildpack",
"metadata": {
"labels": {},
"annotations": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"position": 42,
"enabled": true,
"locked": false,
"lifecycle": "buildpack",
"metadata": {
"labels": {},
"annotations": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"position": 42,
"enabled": true,
"locked": false,
"lifecycle": "buildpack",
"metadata": {
"labels": {},
"annotations": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"position": 42,
"enabled": true,
"locked": false,
"lifecycle": "buildpack",
"metadata": {
"labels": {},
"annotations": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public interface CloudFoundryClient {
/**
* The currently supported Cloud Controller API version
*/
String SUPPORTED_API_VERSION = "2.256.0";
String SUPPORTED_API_VERSION = "2.259.0";

/**
* Main entry point to the Cloud Foundry Application Usage Events Client API
Expand Down
Loading