Skip to content

100 initialize dev user to fake auth in development#104

Open
AnnaLenaO wants to merge 9 commits intomainfrom
100-Initialize-dev-user-to-fake-Auth-in-development
Open

100 initialize dev user to fake auth in development#104
AnnaLenaO wants to merge 9 commits intomainfrom
100-Initialize-dev-user-to-fake-Auth-in-development

Conversation

@AnnaLenaO
Copy link

@AnnaLenaO AnnaLenaO commented May 7, 2025

A fake user with a known email is added to database:
DevelopmentUserInitialize
Test:
DevelopmentUserInitializeSpringBootTest

A custom DevAuthenticationFilter sets the fake users authentication:
DevelopmentAuthenticationFilter
Tests:
DevelopmentAuthenticationFilterTest
DevelopmentAuthenticationFilterSpringBootTest
And a testUserController for a OAuth2User to access.

A service class is added for cleaner and more readable code:
DevelopmentAuthenticationFilterService
Test:
DevelopmentAuthenticationFilterServiceTest

In the security config:
developmentSecurityFilterChain() is updated with .addFilterBefore(developmentAuthenticationFilter, BasicAuthenticationFilter.class) to apply the filter in @Profile("development").

@AnnaLenaO AnnaLenaO self-assigned this May 7, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 7, 2025

@AnnaLenaO AnnaLenaO linked an issue May 7, 2025 that may be closed by this pull request
@AnnaLenaO
Copy link
Author

Java CI with Maven / build (pull_request) Failing:
This is a known issue and a future fix, se #89 Main branch fails to build.

@AnnaLenaO AnnaLenaO added documentation Improvements or additions to documentation enhancement New feature or request backend and removed documentation Improvements or additions to documentation enhancement New feature or request backend labels May 7, 2025
@MustafaGood
Copy link

Bra jobbat, tydlig kod!

Copy link

@MustafaGood MustafaGood left a comment

Choose a reason for hiding this comment

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

Bra jobbat, tydlig kod!

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.

Initialize dev user to fake Auth in development

2 participants