Skip to content

Commit 40d87d7

Browse files
committed
Simplify BasicAuthenticator.extractCredentials() & change unnecessary nullable type
1 parent c29f019 commit 40d87d7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

oauth2-server-core/src/main/java/nl/myndocs/oauth2/request/auth/BasicAuthenticator.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import nl.myndocs.oauth2.request.CallContext
55
import nl.myndocs.oauth2.request.headerCaseInsensitive
66

77
open class BasicAuthenticator(protected val context: CallContext) {
8-
fun extractCredentials(): Credentials? {
9-
val authorizationHeader = context.headerCaseInsensitive("authorization") ?: ""
10-
11-
return BasicAuth.parseCredentials(authorizationHeader)
12-
}
8+
fun extractCredentials() = BasicAuth.parseCredentials(
9+
context.headerCaseInsensitive("authorization") ?: ""
10+
)
1311

1412
fun openAuthenticationDialog() {
1513
context.respondHeader("WWW-Authenticate", "Basic realm=\"${context.queryParameters["client_id"]}\"")

0 commit comments

Comments
 (0)