Commit 7421569e authored by Josh Ji's avatar Josh Ji

get Assertion rp hostname

parent 879545bf
Pipeline #3639 failed with stage
......@@ -12,10 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedList;
import java.util.List;
......@@ -27,7 +24,7 @@ public class GetAssertion {
private CredentialRepository credentialRepository;
@ResponseBody
@PostMapping("/BeginGetAssertion")
public ResponseEntity<PublicKeyCredentialRequestOptions> beginGetAssertion(@RequestParam("username") String username){
public ResponseEntity<PublicKeyCredentialRequestOptions> beginGetAssertion(@RequestHeader("host") String hostname, @RequestParam("username") String username){
Challenge challenge = new DefaultChallenge();
List<Credential> credentials = credentialRepository.getCredentialsByUserName(username);
LinkedList<PublicKeyCredentialDescriptor> publicKeyCredentialDescriptors = new LinkedList<>();
......@@ -35,7 +32,7 @@ public class GetAssertion {
PublicKeyCredentialDescriptor publicKeyCredentialDescriptor = new PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY, credential.getRawId(), null);
publicKeyCredentialDescriptors.add(publicKeyCredentialDescriptor);
}
PublicKeyCredentialRequestOptions options = new PublicKeyCredentialRequestOptions(challenge, null, "localhost", publicKeyCredentialDescriptors, null, null);
PublicKeyCredentialRequestOptions options = new PublicKeyCredentialRequestOptions(challenge, null, hostname.split(":")[0], publicKeyCredentialDescriptors, null, null);
return ResponseEntity.ok(options);
}
@ResponseBody
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment