Skip to content

Commit

Permalink
backend: more kDoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
E3FxGaming committed Jul 21, 2024
1 parent 3b6ee21 commit ad829f3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import io.swagger.v3.oas.models.responses.ApiResponse
import org.springdoc.core.customizers.OpenApiCustomizer
import org.springframework.context.annotation.Configuration


/**
* Configuration used to customize the OpenAPI documentation generated and served by the server.
*/
@Configuration
@OpenAPIDefinition(
info = Info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@ package com.partytime.configuration

import org.springframework.boot.context.properties.ConfigurationProperties

/**
* Configuration properties to be loaded and instantiated with the resources yaml files.
*
* @param jwt Json Web Token configuration property
* @param mail Configuration for mail
* @param url Url used for the server e.g. in Email communication
*/
@ConfigurationProperties(prefix = "party-time")
data class PartyTimeConfigurationProperties(
val jwt: Jwt,
val mail: Mail = Mail(),
val url: String
)

/**
* Json Web Token configuration properties
*
* @param secret Secret used to sign issued Json Web Token
*/
data class Jwt(
val secret: String
)

/**
* Mail configuration properties.
*
* @param enabled Whether actual mail sending should be enabled. If disabled server prints mail content to console.
*/
data class Mail(
val enabled: Boolean = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.filter.CommonsRequestLoggingFilter


/**
* Filter configuration for request logging.
*/
@Configuration
class RequestLoggingFilterConfig {

/**
* Configures a filter that logs requests to console.
*/
@Bean
fun logFilter(): CommonsRequestLoggingFilter {
val filter = CommonsRequestLoggingFilter()
filter.setIncludeQueryString(true)
filter.setIncludePayload(true)
filter.setMaxPayloadLength(10000)
filter.setIncludeHeaders(true)
filter.setAfterMessagePrefix("REQUEST DATA: ")
return filter
fun logFilter(): CommonsRequestLoggingFilter = CommonsRequestLoggingFilter().apply {
setIncludeQueryString(true)
setIncludePayload(true)
setMaxPayloadLength(10000)
setIncludeHeaders(true)
setAfterMessagePrefix("REQUEST DATA: ")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import org.springframework.security.core.AuthenticationException
import org.springframework.security.web.AuthenticationEntryPoint
import org.springframework.stereotype.Component


private val authLogger = KotlinLogging.logger("AuthEntryPointJwt")

/**
* Authentication entry point customization component.
*/
@Component
class AuthEntryPointJwt (
private val objectMapper: ObjectMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package com.partytime.configuration.security
import com.partytime.jpa.entity.Account
import org.springframework.security.core.userdetails.User

/**
* User details used to authenticate users when they want to use protected server functionality.
* Server-internal use only.
*/
class PartyTimeUserDetails(account: Account): User(
account.email, account.pwHash, emptyList()
)

0 comments on commit ad829f3

Please sign in to comment.