-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Trust Mark Types and Issuers
- Loading branch information
Showing
13 changed files
with
344 additions
and
105 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...rc/main/kotlin/com/sphereon/oid/fed/server/admin/controllers/TrustMarkIssuerController.kt
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,57 @@ | ||
package com.sphereon.oid.fed.server.admin.controllers | ||
|
||
import com.sphereon.oid.fed.openapi.models.CreateTrustMarkTypeIssuerDTO | ||
import com.sphereon.oid.fed.persistence.models.TrustMarkIssuer | ||
import com.sphereon.oid.fed.services.AccountService | ||
import com.sphereon.oid.fed.services.TrustMarkService | ||
import org.springframework.web.bind.annotation.DeleteMapping | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/accounts/{username}/trust-mark-types/{id}/issuers") | ||
class TrustMarkIssuerController { | ||
private val accountService = AccountService() | ||
private val trustMarkService = TrustMarkService() | ||
|
||
@GetMapping | ||
fun getIssuersForTrustMarkType( | ||
@PathVariable username: String, | ||
@PathVariable id: Int | ||
): List<String> { | ||
return trustMarkService.getIssuersForTrustMarkType( | ||
accountId = accountService.usernameToAccountId(username), | ||
trustMarkTypeId = id | ||
) | ||
} | ||
|
||
@PostMapping | ||
fun addIssuerToTrustMarkType( | ||
@PathVariable username: String, | ||
@PathVariable id: Int, | ||
@RequestBody body: CreateTrustMarkTypeIssuerDTO | ||
): TrustMarkIssuer { | ||
return trustMarkService.addIssuerToTrustMarkType( | ||
accountId = accountService.usernameToAccountId(username), | ||
trustMarkTypeId = id, | ||
issuerIdentifier = body.identifier | ||
) | ||
} | ||
|
||
@DeleteMapping("/{issuerIdentifier}") | ||
fun removeIssuerFromTrustMarkType( | ||
@PathVariable username: String, | ||
@PathVariable id: Int, | ||
@PathVariable issuerIdentifier: String | ||
): TrustMarkIssuer { | ||
return trustMarkService.removeIssuerFromTrustMarkType( | ||
accountId = accountService.usernameToAccountId(username), | ||
trustMarkTypeId = id, | ||
issuerIdentifier = issuerIdentifier | ||
) | ||
} | ||
} |
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
Oops, something went wrong.