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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public Key resolveSigningKey(JwsHeader header, Claims claims)
}

@Override
public Key resolveSigningKey(JwsHeader header, String plaintext)
public Key resolveSigningKey(JwsHeader header, byte[] plaintext)
{
return getKey(header);
}

private Key getKey(JwsHeader<?> header)
private Key getKey(JwsHeader header)
{
SignatureAlgorithm algorithm = SignatureAlgorithm.forName(header.getAlgorithm());

Expand All @@ -93,7 +93,7 @@ private Key getKey(JwsHeader<?> header)
return key.getKey(algorithm);
}

private static String getKeyId(JwsHeader<?> header)
private static String getKeyId(JwsHeader header)
{
String keyId = header.getKeyId();
if (keyId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public Key resolveSigningKey(JwsHeader header, Claims claims)
}

@Override
public Key resolveSigningKey(JwsHeader header, String plaintext)
public Key resolveSigningKey(JwsHeader header, byte[] plaintext)
{
return getKey(header);
}

private Key getKey(JwsHeader<?> header)
private Key getKey(JwsHeader header)
{
String keyId = header.getKeyId();
if (keyId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static SecretKey getOrGenerateKey(RefreshTokensConfig config)
return signingKey;
}

private static CompressionCodec resolveCompressionCodec(Header<?> header)
private static CompressionCodec resolveCompressionCodec(Header header)
throws CompressionException
{
if (header.getCompressionAlgorithm() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import io.jsonwebtoken.CompressionCodec;
import io.jsonwebtoken.CompressionException;

import java.io.InputStream;
import java.io.OutputStream;

import static java.lang.Math.toIntExact;
import static java.util.Arrays.copyOfRange;

Expand Down Expand Up @@ -50,4 +53,22 @@ public byte[] decompress(byte[] bytes)
new ZstdDecompressor().decompress(bytes, 0, bytes.length, output, 0, output.length);
return output;
}

@Override
public OutputStream compress(OutputStream out)
{
throw new UnsupportedOperationException("Unimplemented method 'compress'");
}

@Override
public InputStream decompress(InputStream in)
{
throw new UnsupportedOperationException("Unimplemented method 'decompress'");
}

@Override
public String getId()
{
throw new UnsupportedOperationException("Unimplemented method 'getId'");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ public Key resolveSigningKey(JwsHeader header, Claims claims)
}

@Override
public Key resolveSigningKey(JwsHeader header, String plaintext)
public Key resolveSigningKey(JwsHeader header, byte[] plaintext)
{
return getKey(header);
}

private Key getKey(JwsHeader<?> header)
private Key getKey(JwsHeader header)
{
String keyId = header.getKeyId();
assertEquals(keyId, "test-rsa");
Expand Down Expand Up @@ -344,12 +344,12 @@ public Key resolveSigningKey(JwsHeader header, Claims claims)
}

@Override
public Key resolveSigningKey(JwsHeader header, String plaintext)
public Key resolveSigningKey(JwsHeader header, byte[] plaintext)
{
return getKey(header);
}

private Key getKey(JwsHeader<?> header)
private Key getKey(JwsHeader header)
{
String keyId = header.getKeyId();
assertEquals(keyId, keyName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static class Oauth2ClientStub
implements OAuth2Client
{
private final Map<String, Object> claims = Jwts.claims()
.setSubject("user");
.setSubject("user").build();

@Override
public void load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwsHeader;
import io.jsonwebtoken.impl.DefaultClaims;
import io.jsonwebtoken.impl.DefaultClaimsBuilder;
import io.trino.security.AccessControl;
import io.trino.server.HttpRequestSessionContextFactory;
import io.trino.server.ProtocolConfig;
Expand Down Expand Up @@ -1297,11 +1298,12 @@ private static String issueToken(Claims claims)

private static Claims createClaims()
{
return new DefaultClaims()
return new DefaultClaimsBuilder()
.setIssuer(TOKEN_ISSUER)
.setAudience(OAUTH_CLIENT_ID)
.setSubject("test-user")
.setExpiration(Date.from(Instant.now().plus(Duration.ofMinutes(5))));
.setExpiration(Date.from(Instant.now().plus(Duration.ofMinutes(5))))
.build();
}

public static String randomNonce()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.getLast;
import static io.trino.filesystem.Locations.isS3Tables;
import static java.lang.Integer.parseInt;
import static java.util.Objects.requireNonNull;
import static java.util.function.Predicate.not;
Expand Down Expand Up @@ -95,7 +96,10 @@ public static Location of(String location)
}
}

checkArgument((userInfo.isEmpty() && host.isEmpty() && port.isEmpty()) || authoritySplit.size() == 2, "Path missing in file system location: %s", location);
if (!isS3Tables(location)) {
// S3 Tables create tables under the bucket like 's3://e97725d9-dbfb-4334-784sox7edps35ncq16arh546frqa1use2b--table-s3'
checkArgument((userInfo.isEmpty() && host.isEmpty() && port.isEmpty()) || authoritySplit.size() == 2, "Path missing in file system location: %s", location);
}
String path = (authoritySplit.size() == 2) ? authoritySplit.get(1) : "";

return new Location(location, Optional.of(scheme), userInfo, host, port, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
*/
package io.trino.filesystem;

import java.util.regex.Pattern;

import static com.google.common.base.Preconditions.checkArgument;

public final class Locations
{
private static final Pattern S3_TABLES = Pattern.compile("s3://(?!.*/).*--table-s3");

private Locations() {}

/**
Expand Down Expand Up @@ -47,4 +51,9 @@ public static boolean areDirectoryLocationsEquivalent(Location leftLocation, Loc
return leftLocation.equals(rightLocation) ||
leftLocation.removeOneTrailingSlash().equals(rightLocation.removeOneTrailingSlash());
}

public static boolean isS3Tables(String location)
{
return S3_TABLES.matcher(location).matches();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed 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.
*/
package io.trino.filesystem.s3;

public final class S3FileSystemConstants
{
public static final String EXTRA_CREDENTIALS_ACCESS_KEY_PROPERTY = "internal$s3_aws_access_key";
public static final String EXTRA_CREDENTIALS_SECRET_KEY_PROPERTY = "internal$s3_aws_secret_key";
public static final String EXTRA_CREDENTIALS_SESSION_TOKEN_PROPERTY = "internal$s3_aws_session_token";

private S3FileSystemConstants() {}
}
4 changes: 3 additions & 1 deletion lib/trino-hive-formats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@
<scope>test</scope>
</dependency>

<!--
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<version>3.18.0</version>
<scope>test</scope>
</dependency>
-->

<dependency>
<groupId>org.assertj</groupId>
Expand Down
6 changes: 6 additions & 0 deletions lib/trino-parquet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format-structures</artifactId>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion plugin/trino-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>3.18.0</version>
</dependency>

<dependency>
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-delta-lake/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format-structures</artifactId>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format-structures</artifactId>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Loading