Compare commits

..

No commits in common. "9a618258bfc18db343a61b4eb8744127d7f8d06c" and "72b5a417f6777805c4752023917465acfae2caef" have entirely different histories.

3 changed files with 12 additions and 13 deletions

View File

@ -1,6 +1,6 @@
---
global-variables:
release: &release ${DRONE_BRANCH##**/}
release: &release ${DRONE_BRANCH##/**}
environment: &environment
JAVA_VERSION: 11
GRADLE_VERSION: 7.1
@ -52,6 +52,7 @@ steps:
- GRADLE_VERSION
- JAVA_VERSION
- CRE_VERSION
- CRE_PORT
repo: *docker-registry-repo
when:
branch: develop
@ -64,8 +65,9 @@ steps:
build_args_from_env:
- GRADLE_VERSION
- JAVA_VERSION
build_args:
- CRE_VERSION=${DRONE_BRANCH##**/}
- CRE_PORT
build-args:
CRE_VERSION: *release
repo: *docker-registry-repo
when:
branch: release/**
@ -83,7 +85,7 @@ steps:
from_secret: deploy_server_ssh_port
DEPLOY_SERVER_SSH_KEY:
from_secret: deploy_server_ssh_key
DEPLOY_CONTAINER_NAME: cre_backend
DEPLOY_CONTAINER_NAME: cre_backend-${DRONE_BRANCH}
DEPLOY_SPRING_PROFILES: mysql,rest
DEPLOY_DATA_VOLUME: /var/cre/data
DEPLOY_CONFIG_VOLUME: /var/cre/config

View File

@ -8,10 +8,7 @@ import dev.fyloz.colorrecipesexplorer.service.CreUserDetailsService
import dev.fyloz.colorrecipesexplorer.service.UserService
import org.slf4j.Logger
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Lazy
import org.springframework.context.annotation.Profile
import org.springframework.context.annotation.*
import org.springframework.core.env.Environment
import org.springframework.http.HttpMethod
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
@ -102,9 +99,11 @@ class SecurityConfig(
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
if (!debugMode) {
http
.authorizeRequests()
.anyRequest().permitAll()
http.authorizeRequests()
.antMatchers("/api/login").permitAll()
.antMatchers("/api/logout").fullyAuthenticated()
.antMatchers("/api/user/current").fullyAuthenticated()
.anyRequest().fullyAuthenticated()
} else {
http
.cors()

View File

@ -32,7 +32,6 @@ class UserController(private val userService: UserService) {
ok(userService.getByIdForOutput(id))
@GetMapping("current")
@PreAuthorize("isFullyAuthenticated()")
fun getCurrent(loggedInUser: Principal?) =
if (loggedInUser != null)
ok(
@ -162,7 +161,6 @@ class GroupsController(
@Profile("!emergency")
class LogoutController(private val userService: UserService) {
@GetMapping("logout")
@PreAuthorize("isFullyAuthenticated()")
fun logout(request: HttpServletRequest) =
ok {
userService.logout(request)