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

Feature/nar 1646 support client issuer in the access token #343

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export class AuthorizationRequestDto extends createZodDto(
AuthorizationRequest.pick({
authentication: true,
request: true,
approvals: true,
metadata: true
}).extend({
mattschoch marked this conversation as resolved.
Show resolved Hide resolved
approvals: AuthorizationRequest.shape.approvals.optional()
})
) {}
5 changes: 3 additions & 2 deletions apps/armory/src/orchestration/http/rest/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ export const toCreateAuthorizationRequest = (
body: AuthorizationRequestDto
): CreateAuthorizationRequest => {
const dto = plainToInstance(AuthorizationRequestDto, body)
const authentication: string = dto.authentication
const approvals: string[] = dto.approvals
const authentication = dto.authentication
const approvals = dto.approvals || []
const metadata: EvaluationMetadata = {
...dto.metadata,
issuer: dto.metadata?.issuer || `${clientId}.armory.narval.xyz`,
samteb marked this conversation as resolved.
Show resolved Hide resolved
expiresIn: dto.metadata?.expiresIn || TEN_MINUTES,
issuedAt: nowSeconds()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ export class ClientController {
const now = new Date()
const engineJwk = body.engineJwk ? publicKeySchema.parse(body.engineJwk) : undefined // Validate the JWK, instead of in DTO
const clientId = body.clientId || uuid()

const client = await this.clientService.save({
clientId,
engineJwk,
audience: body.audience,
issuer: body.issuer || `${clientId}.armory.narval.xyz`,
issuer: body.issuer,
maxTokenAge: body.maxTokenAge,
allowKeyExport: body.allowKeyExport,
backupPublicKey: body.backupPublicKey,
Expand Down