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

Enable resetting application context user to null #4415

Merged
merged 10 commits into from
Dec 30, 2024

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.

Source/Csla/Server/DataPortal.cs Outdated Show resolved Hide resolved
@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
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.

v9-RC1: FlowSecurityPrincipalFromClient = true, throws ArgumentNullException
2 participants