Skip to content

Commit

Permalink
upd backend for request access dialog signed jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed May 12, 2023
1 parent 522cb37 commit 8d463de
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

query GetAccessRequestForm($id: ID!) {
allProductsByNamespace(where: { id: $id }) {
id
name
environments {
id
approval
name
active
flow
additionalDetailsToRequest
legal {
title
description
link
reference
}
credentialIssuer {
clientAuthenticator
}
}
}
allDiscoverableProducts(where: { id: $id }) {
id
name
environments {
id
approval
name
active
flow
additionalDetailsToRequest
legal {
title
description
link
reference
}
credentialIssuer {
clientAuthenticator
}
}
}
myApplications {
id
appId
name
owner {
name
}
}
mySelf {
legalsAgreed
}
allTemporaryIdentities {
id
userId
name
providerUsername
email
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
formData.get('clientAuthenticator') === 'client-jwt-jwks-url'
? formData.get('jwksUrl')
: '',
clientCertificate:
formData.get('clientAuthenticator') === 'client-jwt-jwks-url'
? formData.get('clientCertificate')
: '',
}),
requestor: formData.get('requestor'),
applicationId: formData.get('applicationId'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const AccessRequestForm: React.FC<AccessRequestFormProps> = ({
<Textarea
isRequired
height="64px"
name="publicKey"
name="clientCertificate"
variant="bc-input"
/>
</Box>
Expand Down Expand Up @@ -211,8 +211,9 @@ const AccessRequestForm: React.FC<AccessRequestFormProps> = ({
<input
type="hidden"
name="name"
value={`${dataset.name} FOR ${requestor.name ?? requestor.providerUsername
}`}
value={`${dataset.name} FOR ${
requestor.name ?? requestor.providerUsername
}`}
/>
<input
type="hidden"
Expand Down
6 changes: 3 additions & 3 deletions src/services/keycloak/client-registration-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export class KeycloakClientRegistrationService {
enabled,
clientId,
attributes: {
'jwt.credential.public.key': '',
'jwks.url': jwksUrl,
'use.jwks.url': 'true',
'jwt.credential.public.key': certificate ?? '',
'jwks.url': jwksUrl ?? '',
'use.jwks.url': jwksUrl ? "'true'" : "'false'",
},
});
break;
Expand Down
7 changes: 4 additions & 3 deletions src/services/workflow/generate-credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ export const generateCredential = async (
clientSigning.publicKey = publicKey;
clientSigning.privateKey = privateKey;
controls.clientCertificate = clientSigning.publicKey;
} else {
controls.clientCertificate = null;
}
const newClient = await registerClient(
context,
Expand Down Expand Up @@ -180,7 +178,10 @@ export const generateCredential = async (
clientSecret: controls.clientGenCertificate
? null
: newClient.client.clientSecret,
issuer: controls.jwksUrl ? newClient.openid.issuer : null,
issuer:
controls.jwksUrl || controls.clientCertificate
? newClient.openid.issuer
: null,
tokenEndpoint: newClient.openid.token_endpoint,
clientPublicKey: clientSigning.publicKey,
clientPrivateKey: clientSigning.privateKey,
Expand Down

0 comments on commit 8d463de

Please sign in to comment.