style: スタイルを調整

This commit is contained in:
usbharu 2023-09-23 00:00:19 +09:00
parent b8e4d2dc3b
commit d94b05e50d
9 changed files with 0 additions and 23 deletions

View File

@ -35,7 +35,6 @@ import java.security.interfaces.RSAPrivateKey
import java.security.interfaces.RSAPublicKey
import java.util.*
@EnableWebSecurity(debug = true)
@Configuration
class SecurityConfig {
@ -152,8 +151,6 @@ class SecurityConfig {
if (OAuth2TokenType.ACCESS_TOKEN == context.tokenType) {
val userDetailsImpl = context.getPrincipal<Authentication>().principal as UserDetailsImpl
context.claims.claim("uid", userDetailsImpl.id.toString())
}
}
}

View File

@ -35,5 +35,4 @@ class MastodonAppsApiController(private val appApiService: AppApiService) : AppA
HttpStatus.OK
)
}
}

View File

@ -30,8 +30,6 @@ class UserDetailsImpl(
@Serial
private const val serialVersionUID: Long = -899168205656607781L
}
}
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY)
@ -46,11 +44,9 @@ class UserDetailsImpl(
@JsonSubTypes
abstract class UserDetailsMixin
class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() {
val SIMPLE_GRANTED_AUTHORITY_SET = object : TypeReference<Set<SimpleGrantedAuthority>>() {}
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): UserDetailsImpl {
val mapper = p.codec as ObjectMapper
val jsonNode: JsonNode = mapper.readTree(p)
println(jsonNode)
@ -70,7 +66,6 @@ class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() {
true,
authorities.toMutableList(),
)
}
fun JsonNode.readText(field: String, defaultValue: String = ""): String {
@ -79,5 +74,4 @@ class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() {
else -> defaultValue
}
}
}

View File

@ -175,7 +175,6 @@ class RegisteredClientRepositoryImpl(private val database: Database) : Registere
return builder.build()
}
}
// org/springframework/security/oauth2/server/authorization/client/oauth2-registered-client-schema.sql

View File

@ -13,7 +13,6 @@ interface AccountApiService {
suspend fun verifyCredentials(userid: Long): CredentialAccount
}
@Service
class AccountApiServiceImpl(private val accountService: AccountService, private val transaction: Transaction) :
AccountApiService {
@ -59,5 +58,4 @@ class AccountApiServiceImpl(private val accountService: AccountService, private
role = Role(0, "Admin", "", 32)
)
}
}

View File

@ -18,7 +18,6 @@ interface StatusesApiService {
suspend fun postStatus(statusesRequest: StatusesRequest, user: UserDetailsImpl): Status
}
@Service
class StatsesApiServiceImpl(
private val postService: PostService,
@ -28,7 +27,6 @@ class StatsesApiServiceImpl(
) :
StatusesApiService {
override suspend fun postStatus(statusesRequest: StatusesRequest, user: UserDetailsImpl): Status {
val visibility = when (statusesRequest.visibility) {
StatusesRequest.Visibility.public -> Visibility.PUBLIC
StatusesRequest.Visibility.unlisted -> Visibility.UNLISTED
@ -67,7 +65,6 @@ class StatsesApiServiceImpl(
null
}
return Status(
id = post.id.toString(),
uri = post.apId,

View File

@ -26,11 +26,9 @@ class ExposedOAuth2AuthorizationConsentService(
}
}
override fun save(authorizationConsent: AuthorizationConsent?) = runBlocking {
requireNotNull(authorizationConsent)
transaction.transaction {
val singleOrNull =
OAuth2AuthorizationConsent.select {
OAuth2AuthorizationConsent.registeredClientId
@ -61,7 +59,6 @@ class ExposedOAuth2AuthorizationConsentService(
requireNotNull(registeredClientId)
requireNotNull(principalName)
transaction.transaction {
OAuth2AuthorizationConsent.select {
(OAuth2AuthorizationConsent.registeredClientId eq registeredClientId)
.and(OAuth2AuthorizationConsent.principalName eq principalName)

View File

@ -151,8 +151,6 @@ class ExposedOAuth2AuthorizationService(
override fun findByToken(token: String?, tokenType: OAuth2TokenType?): OAuth2Authorization? = runBlocking {
requireNotNull(token)
transaction.transaction {
when (tokenType?.value) {
null -> {
Authorization.select {

View File

@ -7,12 +7,10 @@ import java.util.*
@Component
class SecureTokenGeneratorImpl : SecureTokenGenerator {
override fun generate(): String {
val byteArray = ByteArray(16)
val secureRandom = SecureRandom()
secureRandom.nextBytes(byteArray)
return Base64.getUrlEncoder().encodeToString(byteArray)
}
}