Skip to content

Conversation

@StefanOssendorf
Copy link
Contributor

Set application context user to an unauthenticated claims principal when FlowSecurityPrincipalFromClient is enabled.

Fixes #4410

…hen FlowSecurityPrincipalFromClient is enabled.

Fixes #4410
Copy link
Member

@rockfordlhotka rockfordlhotka left a comment

Choose a reason for hiding this comment

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

This is in the clear context method - which is there to ensure nothing is left on the server once the data portal operation is complete.

I'm wondering why it matters if the value is left as a null, because nobody should be using it anyway - we're just cleaning up at this point, immediately before leaving the server to return to the client.

@StefanOssendorf
Copy link
Contributor Author

StefanOssendorf commented Dec 24, 2024

This is in the clear context method - which is there to ensure nothing is left on the server once the data portal operation is complete.

I'm wondering why it matters if the value is left as a null, because nobody should be using it anyway - we're just cleaning up at this point, immediately before leaving the server to return to the client.

It matters because we have implementations which don't accept null as a new principal on the application context.

Edit: I'll make it null again, because with my Core-NRT changes it'll be null too 😅

@StefanOssendorf StefanOssendorf changed the title Set application context user to an unauthenticated claims principal Enable resetting application context user to null Dec 25, 2024
@StefanOssendorf StefanOssendorf marked this pull request as draft December 25, 2024 20:21
@StefanOssendorf
Copy link
Contributor Author

Converted the PR to draft.
I'm adding tests to ensure the context managers can handle null as a value.
But the InMemory Contextmanager can't handle that case. Only a ClaimsPrincipal. I think we should default to an empty/unauthenticated ClaimsPrincipal to reduce the error cases.

@StefanOssendorf StefanOssendorf marked this pull request as ready for review December 30, 2024 22:21
@StefanOssendorf
Copy link
Contributor Author

So. I kept the User = null; to make it less impactful on our users. The ApplicationContext now handles the null and translates it into a ClaimsPrincipal(PrincipalIdentity).

@rockfordlhotka rockfordlhotka merged commit 2991105 into main Dec 30, 2024
2 checks passed
@rockfordlhotka rockfordlhotka deleted the dev/fix-4410-flowsecurityprinciaplfromclient branch December 30, 2024 23:13
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v9-RC1: FlowSecurityPrincipalFromClient = true, throws ArgumentNullException

2 participants