mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
32bb44c8a1
commit
78622b5827
|
@ -22,9 +22,13 @@ constructor(
|
|||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is Person) return false
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
other as Person
|
||||
|
||||
if (name != other.name) return false
|
||||
if (id != other.id) return false
|
||||
if (preferredUsername != other.preferredUsername) return false
|
||||
if (summary != other.summary) return false
|
||||
if (inbox != other.inbox) return false
|
||||
|
@ -33,20 +37,26 @@ constructor(
|
|||
if (icon != other.icon) return false
|
||||
if (publicKey != other.publicKey) return false
|
||||
if (endpoints != other.endpoints) return false
|
||||
if (followers != other.followers) return false
|
||||
if (following != other.following) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = super.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + id.hashCode()
|
||||
result = 31 * result + (preferredUsername?.hashCode() ?: 0)
|
||||
result = 31 * result + (summary?.hashCode() ?: 0)
|
||||
result = 31 * result + inbox.hashCode()
|
||||
result = 31 * result + outbox.hashCode()
|
||||
result = 31 * result + url.hashCode()
|
||||
result = 31 * result + (icon?.hashCode() ?: 0)
|
||||
result = 31 * result + (publicKey?.hashCode() ?: 0)
|
||||
result = 31 * result + publicKey.hashCode()
|
||||
result = 31 * result + endpoints.hashCode()
|
||||
result = 31 * result + (followers?.hashCode() ?: 0)
|
||||
result = 31 * result + (following?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ class InboxJobProcessor(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
val verify = try {
|
||||
signatureVerifier.verify(
|
||||
httpRequest,
|
||||
|
|
|
@ -95,15 +95,13 @@ class APUserServiceImpl(
|
|||
name = person.preferredUsername
|
||||
?: throw IllegalActivityPubObjectException("preferredUsername is null"),
|
||||
domain = id.substringAfter("://").substringBefore("/"),
|
||||
screenName = person.name
|
||||
?: throw IllegalActivityPubObjectException("preferredUsername is null"),
|
||||
screenName = person.name,
|
||||
description = person.summary.orEmpty(),
|
||||
inbox = person.inbox,
|
||||
outbox = person.outbox,
|
||||
url = id,
|
||||
publicKey = person.publicKey?.publicKeyPem
|
||||
?: throw IllegalActivityPubObjectException("publicKey is null"),
|
||||
keyId = person.publicKey?.id ?: throw IllegalActivityPubObjectException("publicKey keyId is null"),
|
||||
publicKey = person.publicKey.publicKeyPem,
|
||||
keyId = person.publicKey.id,
|
||||
following = person.following,
|
||||
followers = person.followers,
|
||||
sharedInbox = person.endpoints["sharedInbox"]
|
||||
|
|
|
@ -84,7 +84,9 @@ class SecurityConfig {
|
|||
http {
|
||||
securityMatcher("/users/*/posts/*")
|
||||
addFilterAt<RequestCacheAwareFilter>(httpSignatureFilter)
|
||||
addFilterBefore<HttpSignatureFilter>(ExceptionTranslationFilter(HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)))
|
||||
addFilterBefore<HttpSignatureFilter>(
|
||||
ExceptionTranslationFilter(HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))
|
||||
)
|
||||
authorizeHttpRequests {
|
||||
authorize(anyRequest, permitAll)
|
||||
}
|
||||
|
@ -160,7 +162,6 @@ class SecurityConfig {
|
|||
}
|
||||
oauth2ResourceServer {
|
||||
jwt {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +173,6 @@ class SecurityConfig {
|
|||
fun defaultSecurityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
||||
http {
|
||||
authorizeHttpRequests {
|
||||
|
||||
authorize("/error", permitAll)
|
||||
authorize("/login", permitAll)
|
||||
authorize(GET, "/.well-known/**", permitAll)
|
||||
|
@ -200,7 +200,6 @@ class SecurityConfig {
|
|||
}
|
||||
|
||||
formLogin {
|
||||
|
||||
}
|
||||
|
||||
csrf {
|
||||
|
|
|
@ -27,13 +27,10 @@ class HttpSignatureUserDetailsService(
|
|||
) :
|
||||
AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> {
|
||||
override fun loadUserDetails(token: PreAuthenticatedAuthenticationToken): UserDetails = runBlocking {
|
||||
if (token.principal !is String) {
|
||||
throw IllegalStateException("Token is not String")
|
||||
}
|
||||
check(token.principal is String) { "Token is not String" }
|
||||
val credentials = token.credentials
|
||||
if (credentials !is HttpRequest) {
|
||||
throw IllegalStateException("Credentials is not HttpRequest")
|
||||
}
|
||||
|
||||
check(credentials is HttpRequest) { "Credentials is not HttpRequest" }
|
||||
|
||||
val keyId = token.principal as String
|
||||
val findByKeyId = transaction.transaction {
|
||||
|
|
|
@ -29,6 +29,7 @@ class InMemoryCacheManager : CacheManager {
|
|||
}
|
||||
}
|
||||
if (needRunBlock) {
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
val processed = try {
|
||||
block()
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.security.web.access.intercept.RequestAuthorizationCon
|
|||
fun AuthorizeHttpRequestsDsl.hasScope(scope: String): AuthorizationManager<RequestAuthorizationContext> =
|
||||
hasAuthority("SCOPE_$scope")
|
||||
|
||||
@Suppress("SpreadOperator")
|
||||
fun AuthorizeHttpRequestsDsl.hasAnyScope(vararg scopes: String): AuthorizationManager<RequestAuthorizationContext> =
|
||||
hasAnyAuthority(
|
||||
*scopes.map { "SCOPE_$it" }.toTypedArray()
|
||||
)
|
||||
hasAnyAuthority(*scopes.map { "SCOPE_$it" }.toTypedArray())
|
||||
|
|
Loading…
Reference in New Issue