Formatting Code base with ktlint
[ccsdk/cds.git] / ms / blueprintsprocessor / application / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / security / SecurityContextRepository.kt
index f1c362f..d646c2e 100644 (file)
@@ -25,11 +25,11 @@ import org.springframework.stereotype.Component
 import org.springframework.web.server.ServerWebExchange
 import reactor.core.publisher.Mono
 import java.nio.charset.StandardCharsets
-import java.util.*
+import java.util.Base64
 
 @Component
-class SecurityContextRepository(private val authenticationManager: AuthenticationManager)
-    ServerSecurityContextRepository {
+class SecurityContextRepository(private val authenticationManager: AuthenticationManager) :
+    ServerSecurityContextRepository {
 
     override fun save(swe: ServerWebExchange, sc: SecurityContext): Mono<Void> {
         throw UnsupportedOperationException("Not supported.")
@@ -44,7 +44,7 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
             val password = tokens[1]
             val auth = UsernamePasswordAuthenticationToken(username, password)
             return this.authenticationManager!!.authenticate(auth)
-                    .map { SecurityContextImpl(it) }
+                .map { SecurityContextImpl(it) }
         } else {
             return Mono.empty()
         }
@@ -53,8 +53,10 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
     private fun decodeBasicAuth(authHeader: String): Array<String> {
         val basicAuth: String
         try {
-            basicAuth = String(Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
-                    StandardCharsets.UTF_8)
+            basicAuth = String(
+                Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
+                StandardCharsets.UTF_8
+            )
         } catch (e: IllegalArgumentException) {
             throw BadCredentialsException("Failed to decode basic authentication token")
         } catch (e: IndexOutOfBoundsException) {
@@ -68,4 +70,4 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
 
         return arrayOf(basicAuth.substring(0, delim), basicAuth.substring(delim + 1))
     }
-}
\ No newline at end of file
+}