Skip to content

Conversation

@nijk
Copy link
Contributor

@nijk nijk commented Nov 7, 2025

Ticket: PAE-379

Description

PoC for authorising Defra ID users to access pEPR Organisation data


Please see the Pull Requests standards.

throw Boom.unauthorized()
}

if (data.action === 'link-organisations') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to catch responses which have been "intercepted" by the API so that we can present an "Auth Wall" or "Takeover UI" whereby the user must confirm the link between the Defra ID Organisation in their token and an pEPR Organisation

config.get('appBaseUrl')
)
// const referrer = request.info.referrer
const referrer = 'http://localhost:3000/'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the user is always redirected to the home page

({ defraIdOrgName, defraIdRelationshipId }) => [
{ text: defraIdOrgName },
{
html: `<a href="http://localhost:3200/cdp-defra-id-stub/register/${defraId.userId}/relationship/${defraIdRelationshipId}/current">Switch</a>`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would obviously retrieve protocol, hostname, port from config in the controller so that it works for all environments

organisations: organisations.map(({ name, orgId, id }) => [
{ text: name ?? 'data missing' },
{ text: orgId ?? 'data missing' },
{ text: id ?? 'data missing' },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this defensive coding approach is necessary as I've never seen any of these fields actually missing values

id: userId,
name: displayName
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are likely better ways to share this data between handlers and views in Hapi

- cdp-tenant

defra-id-stub:
profiles: ['all']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have been added to make it simpler to share the same docker compose command between repos, not necessary for the PoC


# queues
aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name cdp-clamav-results
aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name cdp-uploader-download-requests
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't start the stack without this, not sure why it wan't already in the repo

heading: statusCode,
message: errorMessage
message: errorMessage,
defraId: request.server.app.defraId
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we could add the defraId data globally to all views

@nijk nijk force-pushed the PAE-379-poc-server-side-authorisation branch 2 times, most recently from d4ad6e3 to 8051876 Compare November 7, 2025 18:03
border-right: none;
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary styles

@nijk nijk force-pushed the PAE-379-poc-server-side-authorisation branch from 8051876 to bfe335c Compare November 11, 2025 17:05
@nijk nijk force-pushed the PAE-379-poc-server-side-authorisation branch from bfe335c to a0fd39c Compare November 21, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants