Skip to content

Commit

Permalink
fix(core): Fixes urn format for authorization objects
Browse files Browse the repository at this point in the history
  • Loading branch information
betimshahini committed Aug 21, 2023
1 parent 5bb4fc0 commit 3f15d98
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions platform/authorization/src/jsonrpc/methods/exchangeToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ const handleAuthorizationCode: ExchangeTokenMethod<
const scope = (resultMap.get('scope') || []) as string[]
const newPersonaData = (resultMap.get('personaData') || {}) as PersonaData
const nss = `${IdentityURNSpace.decode(identity)}@${clientId}`
const urn = AuthorizationURNSpace.componentizedUrn(nss)
const authorizationNode = initAuthorizationNodeByName(urn, ctx.Authorization)
const baseURN = AuthorizationURNSpace.componentizedUrn(nss)
const authorizationNode = initAuthorizationNodeByName(
baseURN,
ctx.Authorization
)
const { expirationTime } = ACCESS_TOKEN_OPTIONS

//We take the existing (already-authorized) personaData and update it with
Expand All @@ -216,16 +219,16 @@ const handleAuthorizationCode: ExchangeTokenMethod<
clientId,
personaData: combinedPersonaData,
})
const authorization = AuthorizationURNSpace.componentizedUrn(urn, {
const fullAuthzURN = AuthorizationURNSpace.componentizedUrn(nss, {
client_id: clientId,
})
await caller.edges.makeEdge({
src: identity,
dst: authorization,
dst: fullAuthzURN,
tag: EDGE_AUTHORIZES,
})
await setPersonaReferences(
authorization,
fullAuthzURN,
scope,
combinedPersonaData,
ctx.Core,
Expand Down

0 comments on commit 3f15d98

Please sign in to comment.