Skip to content

Commit 283e7eb

Browse files
committed
Remove U2F AppId config environment variable
The setting fell back to a default value when not set, which could cause domain mismatch issues. The features that used this were removed in commit 1f823bc, so there's little reason to keep this configuration setting.
1 parent 9b3258d commit 283e7eb

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

webauthn-server-demo/src/main/java/demo/webauthn/Config.java

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@
2626

2727
import com.yubico.internal.util.CollectionUtil;
2828
import com.yubico.webauthn.data.RelyingPartyIdentity;
29-
import com.yubico.webauthn.extension.appid.AppId;
30-
import com.yubico.webauthn.extension.appid.InvalidAppIdException;
3129
import java.net.MalformedURLException;
3230
import java.util.Arrays;
3331
import java.util.Collections;
3432
import java.util.HashSet;
35-
import java.util.Optional;
3633
import java.util.Set;
3734
import org.slf4j.Logger;
3835
import org.slf4j.LoggerFactory;
@@ -49,26 +46,21 @@ public class Config {
4946
private final Set<String> origins;
5047
private final int port;
5148
private final RelyingPartyIdentity rpIdentity;
52-
private final Optional<AppId> appId;
5349

54-
private Config(
55-
Set<String> origins, int port, RelyingPartyIdentity rpIdentity, Optional<AppId> appId) {
50+
private Config(Set<String> origins, int port, RelyingPartyIdentity rpIdentity) {
5651
this.origins = CollectionUtil.immutableSet(origins);
5752
this.port = port;
5853
this.rpIdentity = rpIdentity;
59-
this.appId = appId;
6054
}
6155

6256
private static Config instance;
6357

6458
private static Config getInstance() {
6559
if (instance == null) {
6660
try {
67-
instance = new Config(computeOrigins(), computePort(), computeRpIdentity(), computeAppId());
61+
instance = new Config(computeOrigins(), computePort(), computeRpIdentity());
6862
} catch (MalformedURLException e) {
6963
throw new RuntimeException(e);
70-
} catch (InvalidAppIdException e) {
71-
throw new RuntimeException(e);
7264
}
7365
}
7466
return instance;
@@ -86,10 +78,6 @@ public static RelyingPartyIdentity getRpIdentity() {
8678
return getInstance().rpIdentity;
8779
}
8880

89-
public static Optional<AppId> getAppId() {
90-
return getInstance().appId;
91-
}
92-
9381
private static Set<String> computeOrigins() {
9482
final String origins = System.getenv("YUBICO_WEBAUTHN_ALLOWED_ORIGINS");
9583

@@ -143,14 +131,4 @@ private static RelyingPartyIdentity computeRpIdentity() throws MalformedURLExcep
143131
logger.info("RP identity: {}", result);
144132
return result;
145133
}
146-
147-
private static Optional<AppId> computeAppId() throws InvalidAppIdException {
148-
final String appId = System.getenv("YUBICO_WEBAUTHN_U2F_APPID");
149-
logger.debug("YUBICO_WEBAUTHN_U2F_APPID: {}", appId);
150-
151-
AppId result = appId == null ? new AppId("https://localhost:8443") : new AppId(appId);
152-
153-
logger.debug("U2F AppId: {}", result.getId());
154-
return Optional.of(result);
155-
}
156134
}

webauthn-server-demo/src/main/java/demo/webauthn/WebAuthnServer.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import com.yubico.webauthn.data.exception.Base64UrlException;
6161
import com.yubico.webauthn.exception.AssertionFailedException;
6262
import com.yubico.webauthn.exception.RegistrationFailedException;
63-
import com.yubico.webauthn.extension.appid.AppId;
6463
import com.yubico.webauthn.extension.appid.InvalidAppIdException;
6564
import demo.webauthn.data.AssertionRequestWrapper;
6665
import demo.webauthn.data.AssertionResponse;
@@ -123,17 +122,15 @@ public WebAuthnServer()
123122
newCache(),
124123
newCache(),
125124
Config.getRpIdentity(),
126-
Config.getOrigins(),
127-
Config.getAppId());
125+
Config.getOrigins());
128126
}
129127

130128
public WebAuthnServer(
131129
InMemoryRegistrationStorage userStorage,
132130
Cache<ByteArray, RegistrationRequest> registerRequestStorage,
133131
Cache<ByteArray, AssertionRequestWrapper> assertRequestStorage,
134132
RelyingPartyIdentity rpIdentity,
135-
Set<String> origins,
136-
Optional<AppId> appId)
133+
Set<String> origins)
137134
throws InvalidAppIdException, CertificateException, CertPathValidatorException,
138135
InvalidAlgorithmParameterException, Base64UrlException, DigestException,
139136
FidoMetadataDownloaderException, UnexpectedLegalHeader, IOException,
@@ -153,7 +150,6 @@ public WebAuthnServer(
153150
.allowOriginSubdomain(false)
154151
.allowUntrustedAttestation(true)
155152
.validateSignatureCounter(true)
156-
.appId(appId)
157153
.build();
158154
}
159155

webauthn-server-demo/src/test/scala/demo/webauthn/WebAuthnServerSpec.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import com.yubico.webauthn.data.Generators.arbitraryAuthenticatorTransport
3838
import com.yubico.webauthn.data.PublicKeyCredentialRequestOptions
3939
import com.yubico.webauthn.data.RelyingPartyIdentity
4040
import com.yubico.webauthn.data.ResidentKeyRequirement
41-
import com.yubico.webauthn.extension.appid.AppId
4241
import demo.webauthn.data.AssertionRequestWrapper
4342
import demo.webauthn.data.CredentialRegistration
4443
import demo.webauthn.data.RegistrationRequest
@@ -72,7 +71,6 @@ class WebAuthnServerSpec
7271
private val rpId =
7372
RelyingPartyIdentity.builder().id("localhost").name("Test party").build()
7473
private val origins = Set("localhost").asJava
75-
private val appId = Optional.empty[AppId]
7674

7775
describe("WebAuthnServer") {
7876

@@ -176,7 +174,6 @@ class WebAuthnServerSpec
176174
newCache(),
177175
rpId,
178176
Set("https://localhost").asJava,
179-
appId,
180177
)
181178

182179
val (cred, keypair) = {
@@ -292,7 +289,6 @@ class WebAuthnServerSpec
292289
assertionRequests,
293290
rpId,
294291
origins,
295-
appId,
296292
)
297293
}
298294
}
@@ -340,7 +336,6 @@ class WebAuthnServerSpec
340336
newCache(),
341337
rpId,
342338
origins,
343-
appId,
344339
)
345340
}
346341

@@ -400,7 +395,6 @@ class WebAuthnServerSpec
400395
newCache(),
401396
rpId,
402397
origins,
403-
appId,
404398
)
405399
}
406400

0 commit comments

Comments
 (0)