Skip to content

Commit bcd3b05

Browse files
access arbitrary claims in vault config
1 parent 8c91b77 commit bcd3b05

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
requires com.google.common;
1313
requires org.slf4j;
1414
requires dagger;
15-
requires com.auth0.jwt;
15+
requires transitive com.auth0.jwt;
1616

1717
// filename-based module required by dagger
1818
// we will probably need to live with this for a while:

src/main/java/org/cryptomator/cryptofs/VaultConfig.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.auth0.jwt.exceptions.JWTDecodeException;
77
import com.auth0.jwt.exceptions.JWTVerificationException;
88
import com.auth0.jwt.exceptions.SignatureVerificationException;
9+
import com.auth0.jwt.interfaces.Claim;
910
import com.auth0.jwt.interfaces.DecodedJWT;
1011
import org.cryptomator.cryptofs.common.Constants;
1112
import org.cryptomator.cryptolib.api.CryptorProvider;
@@ -140,18 +141,22 @@ public URI getKeyId() {
140141
return URI.create(unverifiedConfig.getKeyId());
141142
}
142143

144+
public Claim get(String key) {
145+
return unverifiedConfig.getClaim(key);
146+
}
147+
143148
/**
144149
* @return The unverified vault version (signature not verified)
145150
*/
146151
public int allegedVaultVersion() {
147-
return unverifiedConfig.getClaim(JSON_KEY_VAULTVERSION).asInt();
152+
return get(JSON_KEY_VAULTVERSION).asInt();
148153
}
149154

150155
/**
151156
* @return The unverified shortening threshold (signature not verified)
152157
*/
153158
public int allegedShorteningThreshold() {
154-
return unverifiedConfig.getClaim(JSON_KEY_SHORTENING_THRESHOLD).asInt();
159+
return get(JSON_KEY_SHORTENING_THRESHOLD).asInt();
155160
}
156161

157162
/**

0 commit comments

Comments
 (0)