Open igorlogvin opened 1 year ago
Hi! There is currently no way to do this, it's not supported by WebAuthn. There is some possibility there might be a way in the future, see: https://github.com/w3c/webauthn/issues/1827#issuecomment-1352262450 . But as of now the only solution is to use a redirect or iframe to perform the WebAuthn ceremonies on a single domain.
I am using Java Spring. What if I recreate the RelyingParty bean at runtime like this
/**
* Recreate RelyingParty configuration
*/
public RelyingParty buildRPWithCurrentHost(WebauthnProperties.RelyingParty oldRpData,
String actualHost,
WebauthnCredentialService webauthnCredentialService) throws InvalidAppIdException {
RelyingPartyIdentity newRelyingPartyIdentity = RelyingPartyIdentity.builder()
.id(actualHost)
.name(oldRpData.getName())
.icon(oldRpData.getIcon())
.build();
return RelyingParty.builder()
.identity(newRelyingPartyIdentity)
.credentialRepository(webauthnCredentialService)
.appId(new AppId(oldRpData.getProtocol() + "://" + newRelyingPartyIdentity.getId()))
.origins(oldRpData.getOrigins())
.build();
}
And set result of this method like this in runtime:
try {
RelyingParty newRelyingPartyIdentity = buildRPWithCurrentHost(properties.getRelyingParty(), "online.my-domain2.com" , webauthnCredentialService);
relyingParty.toBuilder()
.identity(newRelyingPartyIdentity.getIdentity())
.appId(newRelyingPartyIdentity.getAppId())
.origins(newRelyingPartyIdentity.getOrigins())
.build();
} catch (InvalidAppIdException invalidAppIdException) {
throw new MyAuthException("Can't create new RP configuration. Reason: ", invalidAppIdException);
}
Doesn't this create problems during further signature validation by the library?
Something like that should work only as long as you don't change the "online.my-domain2.com"
argument. But yes, if you register credentials to one RP ID then you have to authenticate them on the same RP ID. You can use different RP IDs on different domains, of course, but those credentials won't interoperate between different RP IDs.
Yes, I have a task: to make it so that two identical frontends with different domains can use one backend to create a signature and authenticate with it within their domain. Thanks for answers! Helped a lot
Hi @emlun ! Can you please tell me if there is any progress on this issue? https://github.com/w3c/webauthn/issues/1827#issuecomment-1352262450
We are again considering the possibility of creating a signature for our different domains of the "online.my-site.com", "online.my-site-new.com" format, so we asked you to check with you on the progress in implementing this feature?
Hi! Sorry, there is no progress that I know of.
Hello, @emlun ! I have a question. I saw several variants of cross-domain rp-ids, like example:
my-site.my-domain.com
andmy-site-2.my-domain.com
. We could make rp-id likemy-domain.com
. Then ceremonies on subdomains would work correctly. But what if we have this option:online.my-domain.com
andonline.my-domain2.com
? What rp-id can be set so that credentials are created for two domains at once? Thanks