-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue_10080
Signed-off-by: Madhumita Subramaniam <[email protected]>
- Loading branch information
Showing
8 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
jans-fido2/server/src/main/java/io/jans/fido2/ws/rs/controller/WebAuthnController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package io.jans.fido2.ws.rs.controller; | ||
|
||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import io.jans.fido2.model.conf.AppConfiguration; | ||
import io.jans.fido2.model.error.ErrorResponseFactory; | ||
import io.jans.fido2.service.DataMapperService; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
/** | ||
* The endpoint at which the requester can obtain FIDO2 WebAuthn Origins metadata | ||
* configuration | ||
* | ||
* @author Imran Ishaq Date: 11/28/2024 | ||
*/ | ||
@ApplicationScoped | ||
@Path("/webauthn/configuration") | ||
public class WebAuthnController { | ||
@Inject | ||
private AppConfiguration appConfiguration; | ||
|
||
@Inject | ||
private DataMapperService dataMapperService; | ||
|
||
@Inject | ||
private ErrorResponseFactory errorResponseFactory; | ||
@GET | ||
@Produces({ "application/json" }) | ||
public Response getConfiguration() { | ||
if (appConfiguration.getFido2Configuration() == null) { | ||
throw errorResponseFactory.forbiddenException(); | ||
} | ||
|
||
ObjectNode response = dataMapperService.createObjectNode(); | ||
|
||
ArrayNode originsArray = dataMapperService.createArrayNode(); | ||
appConfiguration.getFido2Configuration().getRequestedParties().forEach(rp -> { | ||
rp.getOrigins().forEach(originsArray::add); | ||
}); | ||
response.set("origins", originsArray); | ||
|
||
Response.ResponseBuilder builder = Response.ok().entity(response.toString()); | ||
return builder.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters