Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prism-agent): remove deprecated did-auth endpoints #324

Merged
merged 3 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions prism-agent/service/api/http/castor/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,82 +284,6 @@ components:
type: string
example: "did:prism:123"

# ----------------------------------
# AUTHENTICATION
# ----------------------------------
CreateAuthenticationChallengeRequest:
type: object
required:
- ttl
properties:
ttl:
type: number
description: A number of seconds that challenge will be considered valid.
example: 900
state:
type: string
description: |
An opaque string provided by a relying-party indicating the purpose of
this challenge in order to avoid repurposing the challenge submission.
example: qrcode#123
subject:
$ref: "#/components/schemas/AuthenticationChallengeSubject"

CreateAuthenticationChallengeResponse:
type: object
required:
- challenge
properties:
challenge:
$ref: "#/components/schemas/AuthenticationChallengeJwt"
subject:
$ref: "#/components/schemas/AuthenticationChallengeSubject"

AuthenticationChallengeSubmissionRequest:
type: object
required:
- subject
- challenge
- signature
properties:
challenge:
$ref: "#/components/schemas/AuthenticationChallengeJwt"
subject:
$ref: "#/components/schemas/AuthenticationChallengeSubject"
signature:
type: string
example: 243b9ed6561ab3...5d497f609b8cd04

AuthenticationChallengeSubmissionResponse:
type: object
required:
- success
properties:
success:
type: boolean
example: true
state:
type: string
description: |
An opaque string provided by a relying-party indicating the purpose of
this challenge in order to avoid repurposing the challenge submission.
example: qrcode#123

AuthenticationChallengeSubject:
description: |
A challenged subject that must complete the challenge.
May refer to DID or VerificationMethod inside a DID. If VerificationMethod
is used, it must be inside the authentication verification relationship.
type: string
example: "did:example:123456789abcdefghi"

AuthenticationChallengeJwt:
type: string
description: |
A JWT challenge that a user must provide to Castor SDK to create a ChallengeSubmission.
JWT payload contains nonce, state, expiration, issuer
example: eyJhbGciOiJIUzI1NiIsInR5c...0eu8Ri_WSPSsBTlCes2YMpuB1mHU

ErrorResponse:
type: object
description: An RFC-7807 compliant data structure for reporting errors to the client
Expand Down
59 changes: 0 additions & 59 deletions prism-agent/service/api/http/prism-agent-openapi-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ tags:
# Castor
- name: DID
description: Generic DID Endpoints
- name: DID Authentication
description: DID Authentication REST API
- name: DID Registrar
description: DID Endpoints where keys are managed by PrismAgent
# Pollux
Expand Down Expand Up @@ -63,63 +61,6 @@ paths:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/ErrorResponse"

/authentication/challenges:
post:
tags: ["DID Authentication"]
operationId: createDidAuthenticationChallenge
summary: Create a new authentication challenge
deprecated: true
description: |
Create a new authentication challenge that will be later verified
by Castor for a relying-party.
requestBody:
required: true
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/CreateAuthenticationChallengeRequest"
responses:
"200":
description: Authentication challenge created successfully
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/CreateAuthenticationChallengeResponse"
"400":
description: A create AuthenticationChallenge payload is malformed
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/ErrorResponse"

/authentication/challenge-submissions:
post:
tags: ["DID Authentication"]
operationId: createDidAuthenticationChallengeSubmission
summary: Create a verification from challenge
deprecated: true
description: |
Submit a challenge submission that will be verified by Castor for a relying-party.
requestBody:
required: true
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/AuthenticationChallengeSubmissionRequest"
responses:
"200":
description: Authentication challenge has been successfully verified
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/AuthenticationChallengeSubmissionResponse"
"400":
description: ChallengeSubmission is malformed
content:
application/json:
schema:
$ref: "./castor/schemas.yaml#/components/schemas/ErrorResponse"

/did-registrar/dids:
get:
tags: ["DID Registrar"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@ import io.iohk.atala.castor.core.util.DIDOperationValidator
import io.iohk.atala.agent.server.http.marshaller.{
ConnectionsManagementApiMarshallerImpl,
DIDApiMarshallerImpl,
DIDAuthenticationApiMarshallerImpl,
DIDRegistrarApiMarshallerImpl
}
import io.iohk.atala.agent.server.http.service.{
ConnectionsManagementApiServiceImpl,
DIDApiServiceImpl,
DIDAuthenticationApiServiceImpl,
DIDRegistrarApiServiceImpl
}
import io.iohk.atala.agent.openapi.api.{ConnectionsManagementApi, DIDApi, DIDAuthenticationApi, DIDRegistrarApi}
import io.iohk.atala.agent.server.http.service.{ConnectionsManagementApiServiceImpl, DIDApiServiceImpl}
import io.iohk.atala.agent.openapi.api.{ConnectionsManagementApi, DIDApi, DIDRegistrarApi}
import cats.effect.std.Dispatcher
import com.typesafe.config.ConfigFactory
import doobie.util.transactor.Transactor
Expand Down Expand Up @@ -103,7 +97,7 @@ object Modules {

def app(port: Int): RIO[
DidComm & ManagedDIDService & AppConfig & DIDRegistrarApi & IssueCredentialsProtocolApi & ConnectionsManagementApi &
DIDApi & DIDAuthenticationApi & PresentProofApi & ActorSystem[Nothing],
DIDApi & PresentProofApi & ActorSystem[Nothing],
Unit
] = {
val httpServerApp = HttpRoutes.routes.flatMap(HttpServer.start(port, _))
Expand Down Expand Up @@ -479,12 +473,6 @@ object HttpModule {
(apiServiceLayer ++ apiMarshallerLayer) >>> ZLayer.fromFunction(new DIDApi(_, _))
}

val didAuthenticationApiLayer: ULayer[DIDAuthenticationApi] = {
val apiServiceLayer = DIDAuthenticationApiServiceImpl.layer
val apiMarshallerLayer = DIDAuthenticationApiMarshallerImpl.layer
(apiServiceLayer ++ apiMarshallerLayer) >>> ZLayer.fromFunction(new DIDAuthenticationApi(_, _))
}

val didRegistrarApiLayer: TaskLayer[DIDRegistrarApi] = {
val serviceLayer = AppModule.manageDIDServiceLayer
val apiServiceLayer = serviceLayer >>> DIDRegistrarApiServiceImpl.layer
Expand Down Expand Up @@ -515,7 +503,7 @@ object HttpModule {
}

val layers =
didApiLayer ++ didAuthenticationApiLayer ++ didRegistrarApiLayer ++
didApiLayer ++ didRegistrarApiLayer ++
issueCredentialsProtocolApiLayer ++ connectionsManagementApiLayer ++ presentProofProtocolApiLayer
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import akka.http.scaladsl.server.Directives.*
import io.iohk.atala.agent.openapi.api.{
PresentProofApi,
DIDApi,
DIDAuthenticationApi,
DIDRegistrarApi,
IssueCredentialsProtocolApi,
ConnectionsManagementApi
Expand All @@ -16,19 +15,16 @@ import akka.http.scaladsl.server.Route
object HttpRoutes {

def routes: URIO[
DIDApi & DIDAuthenticationApi & DIDRegistrarApi & IssueCredentialsProtocolApi & ConnectionsManagementApi &
PresentProofApi,
DIDApi & DIDRegistrarApi & IssueCredentialsProtocolApi & ConnectionsManagementApi & PresentProofApi,
Route
] =
for {
didApi <- ZIO.service[DIDApi]
didAuthApi <- ZIO.service[DIDAuthenticationApi]
disRegistrarApi <- ZIO.service[DIDRegistrarApi]
issueCredentialsProtocolApi <- ZIO.service[IssueCredentialsProtocolApi]
connectionsManagementApi <- ZIO.service[ConnectionsManagementApi]
presentProofApi <- ZIO.service[PresentProofApi]
} yield didApi.route ~
didAuthApi.route ~
disRegistrarApi.route ~
issueCredentialsProtocolApi.route ~
connectionsManagementApi.route ~
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ import java.time.OffsetDateTime
trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {

// Castor
given RootJsonFormat[AuthenticationChallengeSubmissionRequest] = jsonFormat3(
AuthenticationChallengeSubmissionRequest.apply
)
given RootJsonFormat[AuthenticationChallengeSubmissionResponse] = jsonFormat2(
AuthenticationChallengeSubmissionResponse.apply
)
given RootJsonFormat[CreateAuthenticationChallengeRequest] = jsonFormat3(CreateAuthenticationChallengeRequest.apply)
given RootJsonFormat[CreateAuthenticationChallengeResponse] = jsonFormat2(CreateAuthenticationChallengeResponse.apply)
given RootJsonFormat[CreateManagedDidRequest] = jsonFormat1(CreateManagedDidRequest.apply)
given RootJsonFormat[CreateManagedDidRequestDocumentTemplate] = jsonFormat2(
CreateManagedDidRequestDocumentTemplate.apply
Expand Down

This file was deleted.