API 1.0.56 SSL domain extension to workouttest.org

This commit is contained in:
Tibor Bossanyi (Freelancer)
2022-10-02 15:13:36 +02:00
parent 435ee0537c
commit 8e7e8ab4e1
20 changed files with 438 additions and 41 deletions
@@ -16,7 +16,7 @@ class ApiApplication {
fun stringEncryptor(): StringEncryptor? {
val encryptor = PooledPBEStringEncryptor()
val config = SimpleStringPBEConfig()
config.password = "Tibor"
config.password = "workouttest"
config.algorithm = "PBEWithMD5AndDES"
config.setKeyObtentionIterations("1000")
config.setPoolSize("1")
@@ -9,7 +9,7 @@ import org.springframework.security.authentication.DisabledException
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import org.springframework.web.bind.annotation.*
import org.springframework.stereotype.Component
import javax.servlet.http.HttpServletRequest
@Component
@@ -27,9 +27,10 @@ class JwtAuthenticationController {
private val jwtUserDetailsService: UserDetailsServiceImpl? = null
@PostMapping("/authenticate")
fun generateAuthenticationToken(@RequestBody authenticationRequest: JwtRequest): ResponseEntity<*> {
fun generateAuthenticationToken(@RequestBody authenticationRequest: JwtRequest, request: HttpServletRequest): ResponseEntity<*> {
authenticate(authenticationRequest.username!!, authenticationRequest.password!!)
println("authenticating from: ${request.remoteAddr}")
val userDetails = jwtUserDetailsService
?.loadUserByUsername(authenticationRequest.username)
@@ -40,7 +41,6 @@ class JwtAuthenticationController {
private fun authenticate(username: String, password: String) {
try {
authenticationManager!!.authenticate(UsernamePasswordAuthenticationToken(username, password))
println("authenticating....")
} catch (e: DisabledException) {
throw Exception("USER_DISABLED", e)
} catch (e: BadCredentialsException) {
@@ -3,15 +3,8 @@ package com.aitrainer.api.security
import java.io.Serializable
class JwtRequest : Serializable {
var username: String? = null
var password: String? = null
//default constructor for JSON Parsing
constructor(username: String?, password: String?) {
this.username = username
this.password = password
}
class JwtRequest//default constructor for JSON Parsing
(var username: String?, var password: String?) : Serializable {
companion object {
private const val serialVersionUID = 5926468583005150707L