line-fido2-server
line-fido2-server copied to clipboard
Modify rpserver's application.yml - endpoint get-delete-credentials
trafficstars
hi
Error “404 NOT_FOUND” while running CredentialController.getCredentialWithCredentialId() method in rpserver.
HTTP GET http://localhost:8081/fido2/credentialsoGLOKkzWdCoIOLa?rpId=localhost
Response 404 NOT_FOUND
I think add a new uri path
getDeleteCredentialsUri: "/fido2/credentials"
getDeleteCredentialsIdUri: "/fido2/credentials/"
or add path "/" inside the getCredentialWithCredentialId() and deleteCredentialWithCredentialId()
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(getDeleteCredentialsUri + "/");
please check this issue.
application.yml
fido2-server:
endpoint:
get-delete-credentials: /fido2/credentials
CredentialController
getDeleteCredentialsUri = uriComponentsBuilder
.scheme(scheme)
.host(fidoServerHost)
.port(fidoServerConfig.getPort())
.path(fidoServerConfig.getEndpoint().getGetDeleteCredentials()) // "/fido2/credentials"
.build().toUriString();
#OK (Matched Path "/fido2/credentials")
path(="/credentials")
getCredentialsWithUsername()
deleteCredentialWithUserName()
#Error (Matched Path = "/fido2/credentials/{id}")
path(="/credentials/{id}")
getCredentialWithCredentialId()
deleteCredentialWithCredentialId()
---
@GetMapping(path = "/credentials/{id}")
public GetCredentialResult getCredentialWithCredentialId(
@PathVariable("id") String credentialId) {
// Error
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(getDeleteCredentialsUri);
// OK
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(getDeleteCredentialsUri + "/");
URI uri = uriComponentsBuilder.path(credentialId)
.queryParam("rpId", rpId)
.build().toUri();
ResponseEntity<GetCredentialResult> response = restTemplate
.exchange(uri, HttpMethod.GET, null, GetCredentialResult.class);
return response.getBody();
}