jakartarized
This commit is contained in:
parent
4a2d743a23
commit
e8354c3f6e
67
build.gradle
67
build.gradle
@ -1,25 +1,20 @@
|
|||||||
buildscript {
|
plugins {
|
||||||
ext {
|
id 'org.springframework.boot' version '3.1.1'
|
||||||
springBootVersion = '2.7.4'
|
id "io.spring.dependency-management" version "1.1.2"
|
||||||
|
id 'java'
|
||||||
|
id 'war'
|
||||||
|
id 'eclipse'
|
||||||
|
id 'application'
|
||||||
}
|
}
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'org.springframework.boot'
|
|
||||||
apply plugin: 'io.spring.dependency-management'
|
|
||||||
apply plugin: 'war'
|
|
||||||
apply plugin: 'application'
|
|
||||||
|
|
||||||
group = 'de.jottyfan.camporganizer'
|
group = 'de.jottyfan.camporganizer'
|
||||||
version = '0.5.3'
|
version = '0.5.4'
|
||||||
|
|
||||||
|
description = """CampOrganizer2"""
|
||||||
|
|
||||||
sourceCompatibility = 17
|
sourceCompatibility = 17
|
||||||
|
targetCompatibility = 17
|
||||||
|
|
||||||
mainClassName = "de.jottyfan.camporganizer.Main"
|
mainClassName = "de.jottyfan.camporganizer.Main"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -27,16 +22,21 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url "https://www.jottyfan.de/libs/"
|
url "https://www.jottyfan.de/libs/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url "https://repo.maven.apache.org/maven2"
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
|
||||||
set('keycloakVersion', '21.1.1')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
war {
|
war {
|
||||||
|
doFirst {
|
||||||
manifest {
|
manifest {
|
||||||
attributes("Implementation-Version": version)
|
attributes("Implementation-Title": project.name,
|
||||||
|
"Implementation-Version": version,
|
||||||
|
"Implementation-Timestamp": new Date())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
baseName = project.name
|
||||||
|
version = version
|
||||||
archiveName = 'CampOrganizer2.war'
|
archiveName = 'CampOrganizer2.war'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +54,10 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'net.sf.biweekly:biweekly:0.6.6'
|
implementation 'net.sf.biweekly:biweekly:0.6.6'
|
||||||
|
|
||||||
implementation 'org.keycloak:keycloak-spring-boot-starter'
|
|
||||||
|
|
||||||
// for using the keycloak rest interface
|
// for using the keycloak rest interface
|
||||||
implementation 'org.keycloak:keycloak-admin-client:21.1.1'
|
implementation 'org.keycloak:keycloak-server-spi:22.0.1'
|
||||||
implementation 'org.jboss.resteasy:resteasy-client:5.0.0.Final'
|
implementation 'org.keycloak:keycloak-admin-client:22.0.0'
|
||||||
|
implementation 'org.jboss.resteasy:resteasy-client:6.2.4.Final'
|
||||||
|
|
||||||
// backward compatibility until the complete registration is converted to keycloak
|
// backward compatibility until the complete registration is converted to keycloak
|
||||||
implementation 'org.jasypt:jasypt:1.9.3'
|
implementation 'org.jasypt:jasypt:1.9.3'
|
||||||
@ -72,19 +71,27 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-jooq'
|
implementation 'org.springframework.boot:spring-boot-starter-jooq'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
|
implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
|
||||||
|
implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.1.1'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
|
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
|
||||||
implementation 'de.jottyfan:COJooq:2023.03'
|
implementation 'de.jottyfan:COJooq:2023.03'
|
||||||
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.0.0'
|
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.0.0'
|
||||||
|
|
||||||
|
implementation 'commons-io:commons-io:2.13.0'
|
||||||
|
|
||||||
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
|
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testImplementation 'org.springframework.security:spring-security-test'
|
testImplementation 'org.springframework.security:spring-security-test'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyManagement {
|
test {
|
||||||
imports {
|
useJUnitPlatform()
|
||||||
mavenBom "org.keycloak.bom:keycloak-adapter-bom:${keycloakVersion}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add version to manifest
|
||||||
|
springBoot {
|
||||||
|
buildInfo()
|
||||||
}
|
}
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
57
gradlew
vendored
57
gradlew
vendored
@ -1,21 +1,5 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@ -44,7 +28,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@ -72,7 +56,7 @@ case "`uname`" in
|
|||||||
Darwin* )
|
Darwin* )
|
||||||
darwin=true
|
darwin=true
|
||||||
;;
|
;;
|
||||||
MSYS* | MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
NONSTOP* )
|
||||||
@ -82,7 +66,6 @@ esac
|
|||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
@ -126,11 +109,10 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
@ -156,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=`expr $i + 1`
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
0) set -- ;;
|
(0) set -- ;;
|
||||||
1) set -- "$args0" ;;
|
(1) set -- "$args0" ;;
|
||||||
2) set -- "$args0" "$args1" ;;
|
(2) set -- "$args0" "$args1" ;;
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -177,9 +159,14 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=`save "$@"`
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS --illegal-access=permit $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
package de.jottyfan.camporganizer.config;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
|
||||||
|
import org.springframework.security.oauth2.core.oidc.user.OidcUserAuthority;
|
||||||
|
import org.springframework.security.oauth2.core.user.OAuth2UserAuthority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class AuthorizationConfiguration {
|
||||||
|
|
||||||
|
private static final String REALM_ACCESS_CLAIM = "realm_access";
|
||||||
|
private static final String ROLES_CLAIM = "roles";
|
||||||
|
private static final String RESOURCE_ACCESS_CLAIM = "resource_access";
|
||||||
|
|
||||||
|
@Value("${spring.security.oauth2.client.registration.keycloak.client-id}")
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
GrantedAuthoritiesMapper userAuthoritiesMapperForKeycloak() {
|
||||||
|
return authorities -> {
|
||||||
|
Set<GrantedAuthority> mappedAuthorities = new HashSet<>();
|
||||||
|
var authority = authorities.iterator().next();
|
||||||
|
boolean isOidc = authority instanceof OidcUserAuthority;
|
||||||
|
|
||||||
|
if (isOidc) {
|
||||||
|
var oidcUserAuthority = (OidcUserAuthority) authority;
|
||||||
|
var userInfo = oidcUserAuthority.getUserInfo();
|
||||||
|
|
||||||
|
if (userInfo.hasClaim(REALM_ACCESS_CLAIM)) {
|
||||||
|
var realmAccess = userInfo.getClaimAsMap(REALM_ACCESS_CLAIM);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
var roles = (Collection<String>) realmAccess.get(ROLES_CLAIM);
|
||||||
|
mappedAuthorities.addAll(generateAuthoritiesFromClaim(roles));
|
||||||
|
}
|
||||||
|
if (userInfo.hasClaim(RESOURCE_ACCESS_CLAIM)) {
|
||||||
|
var resourceAccess = userInfo.getClaimAsMap(RESOURCE_ACCESS_CLAIM);
|
||||||
|
if (resourceAccess.containsKey(clientId)) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
var roles = (Collection<String>) ((Map<?, ?>) resourceAccess.get(clientId)).get(ROLES_CLAIM);
|
||||||
|
mappedAuthorities.addAll(generateAuthoritiesFromClaim(roles));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var oauth2UserAuthority = (OAuth2UserAuthority) authority;
|
||||||
|
Map<String, Object> userAttributes = oauth2UserAuthority.getAttributes();
|
||||||
|
|
||||||
|
if (userAttributes.containsKey(REALM_ACCESS_CLAIM)) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
var realmAccess = (Map<String, Object>) userAttributes.get(REALM_ACCESS_CLAIM);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
var roles = (Collection<String>) realmAccess.get(ROLES_CLAIM);
|
||||||
|
mappedAuthorities.addAll(generateAuthoritiesFromClaim(roles));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappedAuthorities;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Collection<GrantedAuthority> generateAuthoritiesFromClaim(Collection<String> roles) {
|
||||||
|
return roles.stream().map(role -> new SimpleGrantedAuthority("ROLE_" + role)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
@ -1,66 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.config;
|
|
||||||
|
|
||||||
import org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver;
|
|
||||||
import org.keycloak.adapters.springsecurity.KeycloakConfiguration;
|
|
||||||
import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider;
|
|
||||||
import org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter;
|
|
||||||
import org.keycloak.adapters.springsecurity.management.HttpSessionManager;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
||||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.core.authority.mapping.SimpleAuthorityMapper;
|
|
||||||
import org.springframework.security.core.session.SessionRegistryImpl;
|
|
||||||
import org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy;
|
|
||||||
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@KeycloakConfiguration
|
|
||||||
@ComponentScan(basePackageClasses = KeycloakSpringBootConfigResolver.class)
|
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, jsr250Enabled = true)
|
|
||||||
public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
|
||||||
KeycloakAuthenticationProvider keycloakAuthenticationProvider = keycloakAuthenticationProvider();
|
|
||||||
keycloakAuthenticationProvider.setGrantedAuthoritiesMapper(new SimpleAuthorityMapper());
|
|
||||||
auth.authenticationProvider(keycloakAuthenticationProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public KeycloakSpringBootConfigResolver KeycloakConfigResolver() {
|
|
||||||
return new KeycloakSpringBootConfigResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@Override
|
|
||||||
@ConditionalOnMissingBean(HttpSessionManager.class)
|
|
||||||
protected HttpSessionManager httpSessionManager() {
|
|
||||||
return new HttpSessionManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@Override
|
|
||||||
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
|
|
||||||
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
|
||||||
super.configure(http);
|
|
||||||
http.authorizeRequests()
|
|
||||||
// @formatter:off
|
|
||||||
.antMatchers("/dashboard/**", "/business/**", "/confirmation/**").authenticated()
|
|
||||||
.anyRequest().permitAll();
|
|
||||||
// @formatter:on
|
|
||||||
// http.anonymous().disable();
|
|
||||||
http.csrf().disable();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,44 @@
|
|||||||
|
package de.jottyfan.camporganizer.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.Customizer;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.oauth2.client.oidc.web.logout.OidcClientInitiatedLogoutSuccessHandler;
|
||||||
|
import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy;
|
||||||
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableWebSecurity
|
||||||
|
@EnableMethodSecurity
|
||||||
|
public class SecurityConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
|
||||||
|
return new NullAuthenticatedSessionStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SecurityFilterChain securityFilterChain(HttpSecurity sec, InMemoryClientRegistrationRepository crr)
|
||||||
|
throws Exception {
|
||||||
|
sec.csrf(o -> o.disable()).anonymous(o -> o.disable())
|
||||||
|
// @formatter:off
|
||||||
|
.oauth2Login(o -> o.defaultSuccessUrl("/"))
|
||||||
|
.logout(o -> o.logoutSuccessHandler(new OidcClientInitiatedLogoutSuccessHandler(crr)))
|
||||||
|
.authorizeHttpRequests(o -> o.requestMatchers("/dashboard/**", "/business/**", "/confirmation/**").authenticated()
|
||||||
|
.anyRequest().permitAll())
|
||||||
|
.oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults()))
|
||||||
|
.sessionManagement(o -> o.init(sec));
|
||||||
|
// @formatter:on
|
||||||
|
return sec.build();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.DocumentBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.LocationBean;
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
import de.jottyfan.camporganizer.module.mail.MailBean;
|
import de.jottyfan.camporganizer.module.mail.MailBean;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package de.jottyfan.camporganizer.module.admin;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampProfileBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.ProfileBean;
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampProfileBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.PrivilegesContainerBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.ProfileBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -16,7 +16,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -53,7 +53,13 @@ import de.jottyfan.camporganizer.db.jooq.tables.records.TDocumentroleRecord;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TLocationRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TLocationRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
||||||
import de.jottyfan.camporganizer.module.camplist.LambdaResultWrapper;
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.DocumentBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.IntKeyValueBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.LocationBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.PrivilegesContainerBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.ProfileBean;
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_DOCUMENT;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -13,6 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.DocumentBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.LocationBean;
|
||||||
|
import de.jottyfan.camporganizer.module.admin.model.ProfileBean;
|
||||||
import de.jottyfan.camporganizer.module.mail.MailBean;
|
import de.jottyfan.camporganizer.module.mail.MailBean;
|
||||||
import de.jottyfan.camporganizer.module.mail.MailRepository;
|
import de.jottyfan.camporganizer.module.mail.MailRepository;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@ -7,8 +7,8 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,12 +1,12 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TLocationRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TLocationRecord;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.admin;
|
package de.jottyfan.camporganizer.module.admin.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings;
|
package de.jottyfan.camporganizer.module.business.bookings;
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
import jakarta.annotation.security.RolesAllowed;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.bookings.impl.AddPaymentBean;
|
import de.jottyfan.camporganizer.module.business.bookings.model.AddPaymentBean;
|
||||||
import de.jottyfan.camporganizer.module.business.bookings.impl.BookerBean;
|
import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean;
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +27,7 @@ public class BookingsController extends CommonController {
|
|||||||
private static final Logger LOGGER = LogManager.getLogger(BookingsController.class);
|
private static final Logger LOGGER = LogManager.getLogger(BookingsController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBookingsService bookingsService;
|
private BookingsService bookingsService;
|
||||||
|
|
||||||
@GetMapping("/business/bookings")
|
@GetMapping("/business/bookings")
|
||||||
@RolesAllowed({"business_booking"})
|
@RolesAllowed({"business_booking"})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings.impl;
|
package de.jottyfan.camporganizer.module.business.bookings;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
||||||
@ -27,6 +27,7 @@ import de.jottyfan.camporganizer.db.EnumConverter;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,11 +1,11 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings.impl;
|
package de.jottyfan.camporganizer.module.business.bookings;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.bookings.IBookingsService;
|
import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -13,24 +13,20 @@ import de.jottyfan.camporganizer.module.business.bookings.IBookingsService;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BookingsService implements IBookingsService {
|
public class BookingsService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BookingsRepository bookingsGateway;
|
private BookingsRepository bookingsGateway;
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BookerBean> getBookers(String username) {
|
public List<BookerBean> getBookers(String username) {
|
||||||
return bookingsGateway.getBookings(username);
|
return bookingsGateway.getBookings(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BookerBean getBooker(Integer id, String username) {
|
public BookerBean getBooker(Integer id, String username) {
|
||||||
return bookingsGateway.getBooking(id, username);
|
return bookingsGateway.getBooking(id, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer addPayment(Integer id, Double payment) {
|
public Integer addPayment(Integer id, Double payment) {
|
||||||
return bookingsGateway.addPayment(id, payment);
|
return bookingsGateway.addPayment(id, payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,38 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.bookings.impl.BookerBean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IBookingsService {
|
|
||||||
/**
|
|
||||||
* get the bookers information
|
|
||||||
*
|
|
||||||
* @param username the name of the user in this session
|
|
||||||
* @return the list of bookers; an empty one at least
|
|
||||||
*/
|
|
||||||
public List<BookerBean> getBookers(String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the booker referenced by id
|
|
||||||
*
|
|
||||||
* @param id the ID of the booker
|
|
||||||
* @param username the name of the user in this session
|
|
||||||
* @return the booker if found; null otherwise
|
|
||||||
*/
|
|
||||||
public BookerBean getBooker(Integer id, String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add payment to the paid values of user with id
|
|
||||||
*
|
|
||||||
* @param id the ID of the booker
|
|
||||||
* @param payment the payment (additional value)
|
|
||||||
* @return number of affected database rows, should be 1
|
|
||||||
*/
|
|
||||||
public Integer addPayment(Integer id, Double payment);
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings.impl;
|
package de.jottyfan.camporganizer.module.business.bookings.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings.impl;
|
package de.jottyfan.camporganizer.module.business.bookings.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,7 +1,5 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business;
|
package de.jottyfan.camporganizer.module.business.business;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@ -18,15 +16,12 @@ import de.jottyfan.camporganizer.module.camplist.CommonController;
|
|||||||
public class BusinessController extends CommonController {
|
public class BusinessController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private BusinessService service;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBusinessService indexService;
|
|
||||||
|
|
||||||
@GetMapping("/business")
|
@GetMapping("/business")
|
||||||
public String getIndex(Model model) {
|
public String getIndex(Model model) {
|
||||||
String username = indexService.getCurrentUser(request);
|
String username = super.getCurrentUser();
|
||||||
model.addAttribute("campBudgets", indexService.getCampBudgets(username));
|
model.addAttribute("campBudgets", service.getCampBudgets(username));
|
||||||
return "business/business";
|
return "business/business";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business.impl;
|
package de.jottyfan.camporganizer.module.business.business;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
|
||||||
@ -25,6 +25,8 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.business.business.model.BusinessBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -0,0 +1,24 @@
|
|||||||
|
package de.jottyfan.camporganizer.module.business.business;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BusinessService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessRepository gateway;
|
||||||
|
|
||||||
|
public List<CampBudgetBean> getCampBudgets(String username) {
|
||||||
|
return gateway.getCampBudgets(username);
|
||||||
|
}
|
||||||
|
}
|
@ -1,30 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.business.impl.CampBudgetBean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IBusinessService {
|
|
||||||
/**
|
|
||||||
* get the user of this session
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the username of the current user
|
|
||||||
*/
|
|
||||||
public String getCurrentUser(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a list of all camp budgets of all years
|
|
||||||
*
|
|
||||||
* @param username the name of the current user in this session
|
|
||||||
* @return the list; an empty one at least
|
|
||||||
*/
|
|
||||||
public List<CampBudgetBean> getCampBudgets(String username);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.jooq.exception.DataAccessException;
|
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.business.IBusinessService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BusinessService implements IBusinessService {
|
|
||||||
@Autowired
|
|
||||||
private BusinessRepository gateway;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCurrentUser(HttpServletRequest request) {
|
|
||||||
KeycloakSecurityContext ksc = (KeycloakSecurityContext) request
|
|
||||||
.getAttribute(KeycloakSecurityContext.class.getName());
|
|
||||||
if (ksc == null) {
|
|
||||||
throw new DataAccessException("no keycloak user in session");
|
|
||||||
}
|
|
||||||
return ksc.getIdToken().getPreferredUsername();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CampBudgetBean> getCampBudgets(String username) {
|
|
||||||
return gateway.getCampBudgets(username);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business.impl;
|
package de.jottyfan.camporganizer.module.business.business.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.business.impl;
|
package de.jottyfan.camporganizer.module.business.business.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,16 +1,13 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp;
|
package de.jottyfan.camporganizer.module.business.camp;
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.business.IBusinessService;
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
import jakarta.annotation.security.RolesAllowed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -21,18 +18,12 @@ import de.jottyfan.camporganizer.module.camplist.CommonController;
|
|||||||
public class CampController extends CommonController {
|
public class CampController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private CampService campService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBusinessService indexService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ICampService campService;
|
|
||||||
|
|
||||||
@GetMapping("/business/camp/{id}")
|
@GetMapping("/business/camp/{id}")
|
||||||
@RolesAllowed({ "business" })
|
@RolesAllowed({ "business" })
|
||||||
public String getCamp(Model model, @PathVariable Integer id) {
|
public String getCamp(Model model, @PathVariable Integer id) {
|
||||||
String username = indexService.getCurrentUser(request);
|
String username = super.getCurrentUser();
|
||||||
model.addAttribute("currentUser", username);
|
model.addAttribute("currentUser", username);
|
||||||
model.addAttribute("campId", id);
|
model.addAttribute("campId", id);
|
||||||
model.addAttribute("camp", campService.getCamp(id, username));
|
model.addAttribute("camp", campService.getCamp(id, username));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
||||||
@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import de.jottyfan.camporganizer.db.EnumConverter;
|
import de.jottyfan.camporganizer.db.EnumConverter;
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
|
||||||
|
import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -6,7 +6,9 @@ import java.util.List;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.camp.ICampService;
|
import de.jottyfan.camporganizer.module.business.camp.model.BookingBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -14,17 +16,15 @@ import de.jottyfan.camporganizer.module.business.camp.ICampService;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class CampService implements ICampService {
|
public class CampService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CampRepository campGateway;
|
private CampRepository campGateway;
|
||||||
|
|
||||||
@Override
|
|
||||||
public CampBean getCamp(Integer id, String username) {
|
public CampBean getCamp(Integer id, String username) {
|
||||||
return campGateway.getCamp(id, username);
|
return campGateway.getCamp(id, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BookingBean getBookings(Integer id, String username) {
|
public BookingBean getBookings(Integer id, String username) {
|
||||||
Integer approved = 0;
|
Integer approved = 0;
|
||||||
Integer open = 0;
|
Integer open = 0;
|
||||||
@ -49,9 +49,7 @@ public class CampService implements ICampService {
|
|||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PersonBean> getBookers(Integer id, String username) {
|
public List<PersonBean> getBookers(Integer id, String username) {
|
||||||
return campGateway.getBookings(id, username);
|
return campGateway.getBookings(id, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,43 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.camp.impl.BookingBean;
|
|
||||||
import de.jottyfan.camporganizer.module.business.camp.impl.CampBean;
|
|
||||||
import de.jottyfan.camporganizer.module.business.camp.impl.PersonBean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface ICampService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the camp bean of id
|
|
||||||
*
|
|
||||||
* @param id the id of the camp
|
|
||||||
* @param username the name of the user in this session
|
|
||||||
* @return the camp bean if found; null otherwise
|
|
||||||
*/
|
|
||||||
public CampBean getCamp(Integer id, String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the booking information for camp with id
|
|
||||||
*
|
|
||||||
* @param id the id of the camp
|
|
||||||
* @param username the name of the user in this session
|
|
||||||
* @return a booking bean
|
|
||||||
*/
|
|
||||||
public BookingBean getBookings(Integer id, String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the bookers information for camp with id
|
|
||||||
*
|
|
||||||
* @param id the id of the camp
|
|
||||||
* @param username the name of the user in this session
|
|
||||||
* @return the list of bookers; an empty one at least
|
|
||||||
*/
|
|
||||||
public List<PersonBean> getBookers(Integer id, String username);
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,11 +1,11 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.business.privileges.impl.ProfileBean;
|
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.camp.impl;
|
package de.jottyfan.camporganizer.module.business.camp.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,9 +1,5 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.privileges;
|
package de.jottyfan.camporganizer.module.business.privileges;
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.websocket.server.PathParam;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@ -12,10 +8,10 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
||||||
import de.jottyfan.camporganizer.module.business.business.IBusinessService;
|
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean;
|
||||||
import de.jottyfan.camporganizer.module.business.privileges.impl.PrivilegesBean;
|
|
||||||
import de.jottyfan.camporganizer.module.business.privileges.impl.PrivilegesService;
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
import jakarta.annotation.security.RolesAllowed;
|
||||||
|
import jakarta.websocket.server.PathParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -25,19 +21,13 @@ import de.jottyfan.camporganizer.module.camplist.CommonController;
|
|||||||
@Controller
|
@Controller
|
||||||
public class PrivilegesController extends CommonController {
|
public class PrivilegesController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PrivilegesService privilegesService;
|
private PrivilegesService privilegesService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBusinessService indexService;
|
|
||||||
|
|
||||||
@GetMapping("/business/privileges")
|
@GetMapping("/business/privileges")
|
||||||
@RolesAllowed({ "admin" })
|
@RolesAllowed({ "admin" })
|
||||||
public String getIndex(Model model) {
|
public String getIndex(Model model) {
|
||||||
String username = indexService.getCurrentUser(request);
|
String username = super.getCurrentUser();
|
||||||
model.addAttribute("currentUser", username);
|
model.addAttribute("currentUser", username);
|
||||||
model.addAttribute("privileges", privilegesService.getPrivileges());
|
model.addAttribute("privileges", privilegesService.getPrivileges());
|
||||||
model.addAttribute("profiles", privilegesService.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
|
model.addAttribute("profiles", privilegesService.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
|
||||||
@ -59,7 +49,7 @@ public class PrivilegesController extends CommonController {
|
|||||||
PrivilegesBean bean = new PrivilegesBean();
|
PrivilegesBean bean = new PrivilegesBean();
|
||||||
bean.setFkCamp(fkCamp);
|
bean.setFkCamp(fkCamp);
|
||||||
bean.setFkProfile(fkProfile);
|
bean.setFkProfile(fkProfile);
|
||||||
privilegesService.remove(bean, indexService.getCurrentUser(request));
|
privilegesService.remove(bean, super.getCurrentUser());
|
||||||
return getIndex(model);
|
return getIndex(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.privileges.impl;
|
package de.jottyfan.camporganizer.module.business.privileges;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
|
||||||
@ -24,6 +24,8 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TSalesprofileRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TSalesprofileRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.privileges.impl;
|
package de.jottyfan.camporganizer.module.business.privileges;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -10,7 +10,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
||||||
import de.jottyfan.camporganizer.module.business.camp.impl.CampBean;
|
import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean;
|
||||||
|
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.privileges.impl;
|
package de.jottyfan.camporganizer.module.business.privileges.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.privileges.impl;
|
package de.jottyfan.camporganizer.module.business.privileges.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
@ -1,7 +1,9 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.registration.KeycloakRepository;
|
import de.jottyfan.camporganizer.module.registration.KeycloakRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,9 +26,6 @@ import de.jottyfan.camporganizer.module.registration.KeycloakRepository;
|
|||||||
public class CamplistController extends CommonController {
|
public class CamplistController extends CommonController {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(CamplistController.class);
|
private static final Logger LOGGER = LogManager.getLogger(CamplistController.class);
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private KeycloakRepository keycloak;
|
private KeycloakRepository keycloak;
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ public class CamplistController extends CommonController {
|
|||||||
private CamplistService service;
|
private CamplistService service;
|
||||||
|
|
||||||
@GetMapping("/camplist")
|
@GetMapping("/camplist")
|
||||||
public String index(Model model) {
|
public String index(Model model, Principal principal) {
|
||||||
model.addAttribute("camps", service.getAllCamps(true));
|
model.addAttribute("camps", service.getAllCamps(true));
|
||||||
return super.isLoggedIn(request) ? dashboard(model) : "/camplist";
|
return super.isLoggedIn(principal) ? dashboard(model) : "/camplist";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/dashboard")
|
@GetMapping("/dashboard")
|
||||||
public String dashboard(Model model) {
|
public String dashboard(Model model) {
|
||||||
model.addAttribute("mybookings", service.getBookingsOf(super.getCurrentUser(request)));
|
model.addAttribute("mybookings", service.getBookingsOf(super.getCurrentUser()));
|
||||||
model.addAttribute("bookingBean", new BookingBean());
|
model.addAttribute("bookingBean", new BookingBean());
|
||||||
model.addAttribute("keycloakProfileUrl", keycloak.getUserClientUrl());
|
model.addAttribute("keycloakProfileUrl", keycloak.getUserClientUrl());
|
||||||
model.addAttribute("camps", service.getAllCamps(true));
|
model.addAttribute("camps", service.getAllCamps(true));
|
||||||
|
@ -34,6 +34,8 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.DocumentBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.dashboard.DashboardRepository;
|
import de.jottyfan.camporganizer.module.dashboard.DashboardRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import java.security.Principal;
|
||||||
|
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,44 +14,45 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
public abstract class CommonController {
|
public abstract class CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private Principal principal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* try to get current keycloak user
|
* try to get current keycloak user
|
||||||
*
|
*
|
||||||
* @param request the request
|
* @param principal the principal
|
||||||
* @return the preferred username or null
|
* @return the preferred username or null
|
||||||
*/
|
*/
|
||||||
public String getCurrentUser(HttpServletRequest request) {
|
public String getCurrentUser(Principal principal) {
|
||||||
KeycloakSecurityContext ksc = (KeycloakSecurityContext) request
|
return principal.getName();
|
||||||
.getAttribute(KeycloakSecurityContext.class.getName());
|
|
||||||
return ksc == null ? null : ksc.getIdToken().getPreferredUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* try to get th currnt keycloak email
|
* try to get th currnt keycloak email
|
||||||
*
|
*
|
||||||
* @param request the request
|
* @param principal the principal
|
||||||
* @return the email or null
|
* @return the email or null
|
||||||
*/
|
*/
|
||||||
public String getCurrentEmail(HttpServletRequest request) {
|
public String getCurrentEmail(Principal principal) {
|
||||||
KeycloakSecurityContext ksc = (KeycloakSecurityContext) request
|
if (principal instanceof UserDetails) {
|
||||||
.getAttribute(KeycloakSecurityContext.class.getName());
|
UserDetails userDetails = (UserDetails) principal;
|
||||||
return ksc == null ? null : ksc.getIdToken().getEmail();
|
return userDetails.getEmail();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelAttribute("currentUser")
|
@ModelAttribute("currentUser")
|
||||||
public String getCurrentUser() {
|
public String getCurrentUser() {
|
||||||
return getCurrentUser(request);
|
return getCurrentUser(principal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return true if the user has a valid keycloak session token
|
* return true if the user has a valid keycloak session token
|
||||||
*
|
*
|
||||||
* @param request the request
|
* @param principal the principal
|
||||||
* @return true or false
|
* @return true or false
|
||||||
*/
|
*/
|
||||||
public boolean isLoggedIn(HttpServletRequest request) {
|
public boolean isLoggedIn(Principal principal) {
|
||||||
return getCurrentUser(request) != null;
|
return getCurrentUser(principal) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist.model;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.camplist;
|
package de.jottyfan.camporganizer.module.camplist.model;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.info.BuildProperties;
|
import org.springframework.boot.info.BuildProperties;
|
@ -3,15 +3,13 @@ package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.CampOverviewBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -22,14 +20,11 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.CampOverv
|
|||||||
public class ConfirmationController extends CommonController {
|
public class ConfirmationController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private ConfirmationService indexService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IConfirmationService indexService;
|
|
||||||
|
|
||||||
@GetMapping("/confirmation")
|
@GetMapping("/confirmation")
|
||||||
public String getIndex(Model model) {
|
public String getIndex(Model model) {
|
||||||
List<CampOverviewBean> campoverview = indexService.getCampOverview(request);
|
List<CampOverviewBean> campoverview = indexService.getCampOverview(super.getCurrentUser());
|
||||||
CampOverviewBean campoverviewsummary = new CampOverviewBean(LocalDate.now(), "summary");
|
CampOverviewBean campoverviewsummary = new CampOverviewBean(LocalDate.now(), "summary");
|
||||||
for (CampOverviewBean bean : campoverview) {
|
for (CampOverviewBean bean : campoverview) {
|
||||||
campoverviewsummary.setApproved(bean.getApproved() + campoverviewsummary.getApproved());
|
campoverviewsummary.setApproved(bean.getApproved() + campoverviewsummary.getApproved());
|
||||||
@ -38,9 +33,9 @@ public class ConfirmationController extends CommonController {
|
|||||||
}
|
}
|
||||||
model.addAttribute("campoverview", campoverview);
|
model.addAttribute("campoverview", campoverview);
|
||||||
model.addAttribute("campoverviewsummary", campoverviewsummary);
|
model.addAttribute("campoverviewsummary", campoverviewsummary);
|
||||||
model.addAttribute("untouched", indexService.getUntouched(request));
|
model.addAttribute("untouched", indexService.getUntouched(super.getCurrentUser()));
|
||||||
model.addAttribute("approved", indexService.getApproved(request));
|
model.addAttribute("approved", indexService.getApproved(super.getCurrentUser()));
|
||||||
model.addAttribute("rejected", indexService.getRejected(request));
|
model.addAttribute("rejected", indexService.getRejected(super.getCurrentUser()));
|
||||||
return "confirmation/confirmation";
|
return "confirmation/confirmation";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation.impl;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
|
||||||
@ -30,6 +30,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,15 +1,16 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation.impl;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.jooq.exception.DataAccessException;
|
import org.jooq.exception.DataAccessException;
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.IConfirmationService;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -17,45 +18,30 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.IConfirmationS
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ConfirmationService implements IConfirmationService {
|
public class ConfirmationService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfirmationRepository gateway;
|
private ConfirmationRepository gateway;
|
||||||
|
|
||||||
@Override
|
public List<CampOverviewBean> getCampOverview(String currentUser) {
|
||||||
public String getCurrentUser(HttpServletRequest request) {
|
return gateway.getCampOverviewBeans(currentUser);
|
||||||
KeycloakSecurityContext ksc = (KeycloakSecurityContext) request
|
|
||||||
.getAttribute(KeycloakSecurityContext.class.getName());
|
|
||||||
if (ksc == null) {
|
|
||||||
throw new DataAccessException("no keycloak user in session");
|
|
||||||
}
|
|
||||||
return ksc.getIdToken().getPreferredUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<BookingBean> getUntouched(String currentUser) {
|
||||||
public List<CampOverviewBean> getCampOverview(HttpServletRequest request) {
|
return gateway.getUntouched(currentUser);
|
||||||
return gateway.getCampOverviewBeans(getCurrentUser(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<BookingBean> getApproved(String currentUser) {
|
||||||
public List<BookingBean> getUntouched(HttpServletRequest request) {
|
return gateway.getApproved(currentUser);
|
||||||
return gateway.getUntouched(getCurrentUser(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<BookingBean> getRejected(String currentUser) {
|
||||||
public List<BookingBean> getApproved(HttpServletRequest request) {
|
return gateway.getRejected(currentUser);
|
||||||
return gateway.getApproved(getCurrentUser(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String search(String needle, String linkURL, String currentUser) {
|
||||||
public List<BookingBean> getRejected(HttpServletRequest request) {
|
|
||||||
return gateway.getRejected(getCurrentUser(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String search(String needle, String linkURL, HttpServletRequest request) {
|
|
||||||
StringBuilder buf = new StringBuilder(
|
StringBuilder buf = new StringBuilder(
|
||||||
"<table class=\"table table-striped\"><thead><tr><th>Dabei</th><th>Name</th><th>Freizeit</th><th>Rolle</th></tr><tbody>");
|
"<table class=\"table table-striped\"><thead><tr><th>Dabei</th><th>Name</th><th>Freizeit</th><th>Rolle</th></tr><tbody>");
|
||||||
for (BookingBean bean : gateway.getSearchResult(needle, getCurrentUser(request))) {
|
for (BookingBean bean : gateway.getSearchResult(needle, currentUser)) {
|
||||||
String acceptHtml = "";
|
String acceptHtml = "";
|
||||||
if (bean.getAccept() == null) {
|
if (bean.getAccept() == null) {
|
||||||
acceptHtml = "<i class=\"fas fa-question framed framed-orange\"></i>";
|
acceptHtml = "<i class=\"fas fa-question framed framed-orange\"></i>";
|
@ -1,65 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.BookingBean;
|
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.CampOverviewBean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IConfirmationService {
|
|
||||||
/**
|
|
||||||
* get the user of this session
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the username of the current user
|
|
||||||
*/
|
|
||||||
public String getCurrentUser(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a list of the camps and its booking status
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the camp overview beans
|
|
||||||
*/
|
|
||||||
public List<CampOverviewBean> getCampOverview(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a list of bookings that have not yet been worked on
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the list of untouched bookings
|
|
||||||
*/
|
|
||||||
public List<BookingBean> getUntouched(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a list of approved bookings
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the list of approved bookings
|
|
||||||
*/
|
|
||||||
public List<BookingBean> getApproved(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get a list of rejected bookings
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @return the list of rejected bookings
|
|
||||||
*/
|
|
||||||
public List<BookingBean> getRejected(HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the result of a search for needle in the database
|
|
||||||
*
|
|
||||||
* @param needle the needle; may be a name of anything
|
|
||||||
* @param linkURL the URL of the link for clicking on the found entity
|
|
||||||
* @param request the request
|
|
||||||
* @return the result in html format (for now)
|
|
||||||
*/
|
|
||||||
public String search(String needle, String linkURL, HttpServletRequest request);
|
|
||||||
}
|
|
@ -1,31 +1,32 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.websocket.server.PathParam;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.websocket.server.PathParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jotty
|
* @author jotty
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SearchController {
|
public class SearchController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IConfirmationService service;
|
private ConfirmationService service;
|
||||||
|
|
||||||
@GetMapping("/confirmation/search")
|
@GetMapping("/confirmation/search")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String search(@PathParam(value = "needle") String needle, Model model) {
|
public String search(@PathParam(value = "needle") String needle, Model model) {
|
||||||
return service.search(needle, request.getRequestURI().replace("search", "person"), request);
|
return service.search(needle, request.getRequestURI().replace("search", "person"), super.getCurrentUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation.impl;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation.impl;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.confirmation.impl;
|
package de.jottyfan.camporganizer.module.confirmation.confirmation.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,7 +1,5 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person;
|
package de.jottyfan.camporganizer.module.confirmation.person;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@ -11,9 +9,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.IConfirmationService;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.ConfirmationService;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.person.impl.PersonBean;
|
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.person.impl.PersonService;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -23,18 +21,12 @@ import de.jottyfan.camporganizer.module.confirmation.person.impl.PersonService;
|
|||||||
@Controller
|
@Controller
|
||||||
public class PersonController extends CommonController {
|
public class PersonController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IConfirmationService confirmationService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
@GetMapping("/confirmation/person/{pk}")
|
@GetMapping("/confirmation/person/{pk}")
|
||||||
public String getIndex(Model model, @PathVariable Integer pk) {
|
public String getIndex(Model model, @PathVariable Integer pk) {
|
||||||
String username = confirmationService.getCurrentUser(request);
|
String username = super.getCurrentUser();
|
||||||
model.addAttribute("currentUser", username);
|
model.addAttribute("currentUser", username);
|
||||||
model.addAttribute("person", personService.getPerson(username, pk));
|
model.addAttribute("person", personService.getPerson(username, pk));
|
||||||
model.addAttribute("camps", personService.getCamps(username));
|
model.addAttribute("camps", personService.getCamps(username));
|
||||||
@ -44,7 +36,7 @@ public class PersonController extends CommonController {
|
|||||||
|
|
||||||
@PostMapping("/confirmation/person/update")
|
@PostMapping("/confirmation/person/update")
|
||||||
public String doUpdate(@ModelAttribute PersonBean bean, Model model) {
|
public String doUpdate(@ModelAttribute PersonBean bean, Model model) {
|
||||||
String username = confirmationService.getCurrentUser(request);
|
String username = super.getCurrentUser();
|
||||||
personService.updatePerson(bean, username);
|
personService.updatePerson(bean, username);
|
||||||
return "redirect:/confirmation";
|
return "redirect:/confirmation";
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person.impl;
|
package de.jottyfan.camporganizer.module.confirmation.person;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
|
||||||
@ -36,7 +36,9 @@ import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
||||||
import de.jottyfan.camporganizer.module.camplist.LambdaResultWrapper;
|
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.person.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
|
||||||
import de.jottyfan.camporganizer.module.mail.MailBean;
|
import de.jottyfan.camporganizer.module.mail.MailBean;
|
||||||
import de.jottyfan.camporganizer.module.mail.MailRepository;
|
import de.jottyfan.camporganizer.module.mail.MailRepository;
|
||||||
|
|
@ -1,10 +1,13 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person.impl;
|
package de.jottyfan.camporganizer.module.confirmation.person;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.person.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jotty
|
* @author jotty
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person.impl;
|
package de.jottyfan.camporganizer.module.confirmation.person.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person.impl;
|
package de.jottyfan.camporganizer.module.confirmation.person.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
@ -21,8 +21,8 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumFiletype;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
||||||
import de.jottyfan.camporganizer.module.camplist.BookingBean;
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.camplist.LambdaResultWrapper;
|
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
import javax.servlet.http.Part;
|
import jakarta.servlet.http.Part;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package de.jottyfan.camporganizer.module.document;
|
|||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.io.ByteArrayResource;
|
import org.springframework.core.io.ByteArrayResource;
|
||||||
|
@ -2,7 +2,7 @@ package de.jottyfan.camporganizer.module.ical;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -19,7 +19,7 @@ import de.jottyfan.camporganizer.module.camplist.CommonController;
|
|||||||
public class ICalController extends CommonController {
|
public class ICalController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IICalService service;
|
private ICalService service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate the ical response stream
|
* generate the ical response stream
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.ical.impl;
|
package de.jottyfan.camporganizer.module.ical;
|
||||||
|
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
||||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
|
@ -1,15 +1,13 @@
|
|||||||
package de.jottyfan.camporganizer.module.ical.impl;
|
package de.jottyfan.camporganizer.module.ical;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import biweekly.Biweekly;
|
import biweekly.Biweekly;
|
||||||
import biweekly.ICalendar;
|
import biweekly.ICalendar;
|
||||||
import de.jottyfan.camporganizer.module.ical.IICalService;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -17,12 +15,11 @@ import de.jottyfan.camporganizer.module.ical.IICalService;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ICalService implements IICalService {
|
public class ICalService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICalRepository gateway;
|
private ICalRepository gateway;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean generate(HttpServletResponse response) throws IOException {
|
public Boolean generate(HttpServletResponse response) throws IOException {
|
||||||
ICalendar ical = gateway.getIcal();
|
ICalendar ical = gateway.getIcal();
|
||||||
String content = Biweekly.write(ical).go();
|
String content = Biweekly.write(ical).go();
|
||||||
@ -37,5 +34,4 @@ public class ICalService implements IICalService {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,23 +0,0 @@
|
|||||||
package de.jottyfan.camporganizer.module.ical;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author jotty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IICalService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* generate the ical
|
|
||||||
*
|
|
||||||
* @param response the response for the output stream
|
|
||||||
*
|
|
||||||
* @return true if successful, false otherwise
|
|
||||||
* @throws IOException on io errors
|
|
||||||
*/
|
|
||||||
public Boolean generate(HttpServletResponse response) throws IOException;
|
|
||||||
}
|
|
@ -5,8 +5,8 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -3,8 +3,8 @@ package de.jottyfan.camporganizer.module.mail;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import jakarta.mail.MessagingException;
|
||||||
import javax.mail.internet.MimeMessage;
|
import jakarta.mail.internet.MimeMessage;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -2,8 +2,8 @@ package de.jottyfan.camporganizer.module.migration;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
|
import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
|
||||||
import org.jasypt.util.password.StrongPasswordEncryptor;
|
import org.jasypt.util.password.StrongPasswordEncryptor;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package de.jottyfan.camporganizer.module.migration;
|
package de.jottyfan.camporganizer.module.migration;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package de.jottyfan.camporganizer.module.migration;
|
package de.jottyfan.camporganizer.module.migration;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -3,8 +3,8 @@ package de.jottyfan.camporganizer.module.registration;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import jakarta.ws.rs.core.Response.Status;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package de.jottyfan.camporganizer.module.registration;
|
package de.jottyfan.camporganizer.module.registration;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import de.jottyfan.camporganizer.db.EnumConverter;
|
import de.jottyfan.camporganizer.db.EnumConverter;
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -43,8 +43,11 @@ import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
|||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
|
||||||
import de.jottyfan.camporganizer.module.camplist.BookingBean;
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.camplist.LambdaResultWrapper;
|
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.ProfileBean;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,9 @@ package de.jottyfan.camporganizer.module.registration;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.BookingBean;
|
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.CampBean;
|
||||||
|
import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.registration;
|
package de.jottyfan.camporganizer.module.registration.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.jottyfan.camporganizer.module.registration;
|
package de.jottyfan.camporganizer.module.registration.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package de.jottyfan.camporganizer.module.registration;
|
package de.jottyfan.camporganizer.module.registration.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
@ -6,8 +6,8 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
import jakarta.validation.Constraint;
|
||||||
import javax.validation.Payload;
|
import jakarta.validation.Payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -2,8 +2,8 @@ package de.jottyfan.camporganizer.module.registration.validate;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
import jakarta.validation.ConstraintValidator;
|
||||||
import javax.validation.ConstraintValidatorContext;
|
import jakarta.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
import org.springframework.beans.BeanWrapperImpl;
|
import org.springframework.beans.BeanWrapperImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -6,8 +6,8 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
import jakarta.validation.Constraint;
|
||||||
import javax.validation.Payload;
|
import jakarta.validation.Payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package de.jottyfan.camporganizer.module.registration.validate;
|
package de.jottyfan.camporganizer.module.registration.validate;
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
import jakarta.validation.ConstraintValidator;
|
||||||
import javax.validation.ConstraintValidatorContext;
|
import jakarta.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
import org.springframework.beans.BeanWrapperImpl;
|
import org.springframework.beans.BeanWrapperImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package de.jottyfan.camporganizer.module.rss;
|
package de.jottyfan.camporganizer.module.rss;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -5,7 +5,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -9,11 +9,17 @@ spring.datasource.password = ${spring.datasource.password}
|
|||||||
|
|
||||||
server.servlet.context-path = ${server.servlet.context-path:/CampOrganizer2}
|
server.servlet.context-path = ${server.servlet.context-path:/CampOrganizer2}
|
||||||
|
|
||||||
keycloak.auth-server-url = ${keycloak.auth-server-url}
|
# security
|
||||||
keycloak.realm = ${keycloak.realm:ow}
|
spring.security.oauth2.client.registration.keycloak.client-id = ${keycloak.client-id}
|
||||||
keycloak.resource = ${keycloak.resource:biblecamp}
|
spring.security.oauth2.client.registration.keycloak.scope = openid
|
||||||
keycloak.public-client = ${keycloak.public-client}
|
spring.security.oauth2.client.registration.keycloak.authorization-grant-type = authorization_code
|
||||||
keycloak.use-resource-role-mappings = ${keycloak.use-resource-role-mappings}
|
spring.security.oauth2.client.registration.keycloak.redirect-uri = ${keycloak.redirect-uri}
|
||||||
|
spring.security.oauth2.client.provider.keycloak.issuer-uri = ${keycloak.issuer-uri}
|
||||||
|
spring.security.oauth2.client.provider.keycloak.authorization-uri = ${keycloak.openid-url}/auth
|
||||||
|
spring.security.oauth2.client.provider.keycloak.token-uri = ${keycloak.openid-url}/token
|
||||||
|
spring.security.oauth2.client.provider.keycloak.user-info-uri = ${keycloak.openid-url}/userinfo
|
||||||
|
spring.security.oauth2.client.provider.keycloak.jwk-set-uri = ${keycloak.openid-url}/certs
|
||||||
|
spring.security.oauth2.client.provider.keycloak.user-name-attribute = preferred_username
|
||||||
|
|
||||||
ow.keycloak.admin.name = ${ow.keycloak.admin.name}
|
ow.keycloak.admin.name = ${ow.keycloak.admin.name}
|
||||||
ow.keycloak.admin.password = ${ow.keycloak.admin.password}
|
ow.keycloak.admin.password = ${ow.keycloak.admin.password}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user