fix: resolve CI compile failure and complete OAuth2 review fixes

Agent-Logs-Url: https://github.com/devitq/movienight-backend/sessions/62eaa8e4-560b-4737-be4b-478f1a4c484a

Co-authored-by: devitq <118541411+devitq@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-08 17:37:35 +00:00
committed by GitHub
co-authored by devitq
parent 0aa7dcaf98
commit 0b57c31611
6 changed files with 73 additions and 74 deletions
@@ -18,22 +18,22 @@ class SecurityConfiguration(
oauth2
.userInfoEndpoint { userInfo ->
userInfo.userService(customOAuth2UserService)
}
.defaultSuccessUrl("/api/users/me", true)
}
.authorizeHttpRequests { auth ->
}.defaultSuccessUrl("/api/users/me", true)
}.authorizeHttpRequests { auth ->
auth
.requestMatchers("/", "/login/**", "/oauth2/**", "/h2-console/**", "/actuator/health").permitAll()
.requestMatchers("/api/users/me").authenticated()
.requestMatchers("/api/**").authenticated()
.anyRequest().authenticated()
}
.headers { headers ->
.requestMatchers("/", "/login/**", "/oauth2/**", "/h2-console/**", "/actuator/health")
.permitAll()
.requestMatchers("/api/users/me")
.authenticated()
.requestMatchers("/api/**")
.authenticated()
.anyRequest()
.authenticated()
}.headers { headers ->
headers.frameOptions { frameOptions ->
frameOptions.sameOrigin()
}
}
.csrf { csrf ->
}.csrf { csrf ->
csrf.disable()
}
@@ -10,8 +10,8 @@ import java.util.UUID
class UserPrincipal(
private val user: User,
private val attributes: Map<String, Any>? = null,
) : OAuth2User, UserDetails {
) : OAuth2User,
UserDetails {
fun getId(): UUID = user.id
override fun getName(): String = user.name
@@ -19,7 +19,9 @@ class UserPrincipal(
override fun getAttributes(): Map<String, Any> = attributes ?: emptyMap()
override fun getAuthorities(): Collection<GrantedAuthority> =
listOf(SimpleGrantedAuthority("ROLE_USER"))
listOf(
SimpleGrantedAuthority("ROLE_USER"),
)
override fun getPassword(): String = ""
@@ -34,7 +36,9 @@ class UserPrincipal(
override fun isEnabled(): Boolean = true
companion object {
fun create(user: User, attributes: Map<String, Any>? = null): UserPrincipal =
UserPrincipal(user, attributes)
fun create(
user: User,
attributes: Map<String, Any>? = null,
): UserPrincipal = UserPrincipal(user, attributes)
}
}