Skip to content

Commit

Permalink
PSG-4172: Passage OIDC added, passage.kt updated
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaSeylani committed Jun 28, 2024
1 parent 5e7c4e0 commit fa2d3b3
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 1 deletion.
43 changes: 42 additions & 1 deletion passage/src/main/java/id/passage/android/Passage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ public final class Passage(
internal companion object {
internal const val TAG = "Passage"
internal var BASE_PATH = "https://auth.passage.id/v1"

internal lateinit var BASE_PATH_OIDC : String

Check failure on line 41 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L41 <standard:property-naming>

Property name should start with a lowercase letter and use camel case
Raw output
passage/src/main/java/id/passage/android/Passage.kt:41:31: error: Property name should start with a lowercase letter and use camel case (standard:property-naming)

Check failure on line 41 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L41 <standard:colon-spacing>

Unexpected spacing before ":"
Raw output
passage/src/main/java/id/passage/android/Passage.kt:41:46: error: Unexpected spacing before ":" (standard:colon-spacing)
internal lateinit var Package_NAME : String

Check failure on line 42 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L42 <standard:property-naming>

Property name should start with a lowercase letter and use camel case
Raw output
passage/src/main/java/id/passage/android/Passage.kt:42:31: error: Property name should start with a lowercase letter and use camel case (standard:property-naming)

Check failure on line 42 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L42 <standard:colon-spacing>

Unexpected spacing before ":"
Raw output
passage/src/main/java/id/passage/android/Passage.kt:42:44: error: Unexpected spacing before ":" (standard:colon-spacing)
internal lateinit var appId: String
internal lateinit var clientSecret: String
internal lateinit var authOrigin: String
internal var language: String? = null

Expand Down Expand Up @@ -80,7 +82,10 @@ public final class Passage(
init {
authOrigin = getRequiredResourceFromApp(activity, "passage_auth_origin")
Companion.appId = appId ?: getRequiredResourceFromApp(activity, "passage_app_id")
clientSecret = getRequiredResourceFromApp(activity, "passage_client_secret")
language = getOptionalResourceFromApp(activity, "passage_language")
BASE_PATH_OIDC = "https://$authOrigin"

Check failure on line 87 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L87 <standard:no-multi-spaces>

Unnecessary long whitespace
Raw output
passage/src/main/java/id/passage/android/Passage.kt:87:26: error: Unnecessary long whitespace (standard:no-multi-spaces)
Package_NAME = activity.packageName

val usePassageStore = getOptionalResourceFromApp(activity, "use_passage_store")
if (usePassageStore != "false") {
Expand Down Expand Up @@ -654,4 +659,40 @@ public final class Passage(
tokenStore.setTokens(authResult)
}
// endregion


Check failure on line 663 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L663 <standard:no-consecutive-blank-lines>

Needless blank line(s)
Raw output
passage/src/main/java/id/passage/android/Passage.kt:663:1: error: Needless blank line(s) (standard:no-consecutive-blank-lines)
// region OIDC Methods

/**
* Authorize with OIDC
*
* Authorizes user via a OIDC Login feature.
*/
public suspend fun startOIDC() {
PassageOIDC.openChromeTab(
appInfo().id,
activity,
authUrl = "${BASE_PATH_OIDC}/authorize",
)
}

/**
* Finish OIDC login
*
* Finishes a OIDC login/sign up by exchanging the auth code for Passage tokens.
* @param code The code returned from the OIDC login.
* @return PassageAuthResult
* @throws FinishOIDCException
*/

suspend fun finishOIDC(code: String) {
try {
val authResult = PassageOIDC.finishOIDC(code)
if (authResult != null) handleAuthResult(authResult)

Check failure on line 692 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L692 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
passage/src/main/java/id/passage/android/Passage.kt:692:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
} catch (e : Exception) {

Check failure on line 693 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L693 <standard:parameter-list-spacing>

Unexpected whitespace
Raw output
passage/src/main/java/id/passage/android/Passage.kt:693:19: error: Unexpected whitespace (standard:parameter-list-spacing)

Check failure on line 693 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L693 <standard:colon-spacing>

Unexpected spacing before ":"
Raw output
passage/src/main/java/id/passage/android/Passage.kt:693:20: error: Unexpected spacing before ":" (standard:colon-spacing)
throw FinishOIDCException.convert(e)

Check failure on line 694 in passage/src/main/java/id/passage/android/Passage.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/Passage.kt#L694 <standard:no-multi-spaces>

Unnecessary long whitespace
Raw output
passage/src/main/java/id/passage/android/Passage.kt:694:19: error: Unnecessary long whitespace (standard:no-multi-spaces)
}
}
// endregion
}
134 changes: 134 additions & 0 deletions passage/src/main/java/id/passage/android/PassageOIDC.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package id.passage.android

import android.app.Activity
import android.net.Uri
import androidx.browser.customtabs.CustomTabsIntent
import com.squareup.moshi.JsonClass
import com.squareup.moshi.Moshi
import id.passage.android.model.AuthResult
import id.passage.client.infrastructure.ClientException
import id.passage.client.infrastructure.ServerException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import java.net.URLEncoder
import java.security.MessageDigest
import java.security.SecureRandom
import java.util.Base64

internal class PassageOIDC {
internal companion object {
internal var verifier = ""
private const val CODE_CHALLENGE_METHOD = "S256"
private const val SECRET_STRING_LENGTH = 32

internal fun openChromeTab(
appId: String,

Check failure on line 29 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L29 <standard:parameter-list-spacing>

Expected a single space
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:29:19: error: Expected a single space (standard:parameter-list-spacing)

Check failure on line 29 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L29 <standard:no-multi-spaces>

Unnecessary long whitespace
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:29:20: error: Unnecessary long whitespace (standard:no-multi-spaces)
activity: Activity,
authUrl: String,
) {
val redirectUri = "${Passage.BASE_PATH_OIDC}/android/${Passage.Package_NAME}/callback"
val state = getRandomString()
val randomString = getRandomString()
verifier = randomString
val codeChallenge = sha256Hash(randomString)
val newParams = listOf(

Check failure on line 38 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L38 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:38:29: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
"client_id" to appId,
"redirect_uri" to redirectUri,
"state" to state,
"code_challenge" to codeChallenge,
"code_challenge_method" to CODE_CHALLENGE_METHOD,
"scope" to "openid",
"response_type" to "code",
).joinToString("&") {
(key, value) ->

Check failure on line 47 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L47 <standard:function-literal>

No newline expected before parameter
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:47:21: error: No newline expected before parameter (standard:function-literal)
"$key=${URLEncoder.encode(value, "UTF-8")}"
}
val url = "${authUrl}?${newParams}"

Check failure on line 50 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L50 <standard:string-template>

Redundant curly braces
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:50:25: error: Redundant curly braces (standard:string-template)

Check failure on line 50 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L50 <standard:string-template>

Redundant curly braces
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:50:36: error: Redundant curly braces (standard:string-template)
val intent = CustomTabsIntent.Builder().build()
intent.launchUrl(activity, Uri.parse(url))
}

private fun getRandomString(): String {
val digits = '0'..'9'
val upperCaseLetters = 'A'..'Z'
val lowerCaseLetters = 'a'..'z'
val characters =
(digits + upperCaseLetters + lowerCaseLetters)
.joinToString("")
val random = SecureRandom()
val stringBuilder = StringBuilder(SECRET_STRING_LENGTH)
for (i in 0 until SECRET_STRING_LENGTH) {
val randomIndex = random.nextInt(characters.length)
stringBuilder.append(characters[randomIndex])
}
return stringBuilder.toString()
}

private fun sha256Hash(randomString: String): String {
val bytes = randomString.toByteArray()
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(bytes)
return Base64.getUrlEncoder().withoutPadding().encodeToString(digest)
}


Check failure on line 78 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L78 <standard:no-consecutive-blank-lines>

Needless blank line(s)
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:78:1: error: Needless blank line(s) (standard:no-consecutive-blank-lines)
internal suspend fun finishOIDC(code: String) : AuthResult? {

Check failure on line 79 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L79 <standard:function-return-type-spacing>

Unexpected whitespace
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:79:54: error: Unexpected whitespace (standard:function-return-type-spacing)

Check failure on line 79 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L79 <standard:colon-spacing>

Unexpected spacing before ":"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:79:55: error: Unexpected spacing before ":" (standard:colon-spacing)
val redirectUri = "${Passage.BASE_PATH_OIDC}/android/${Passage.Package_NAME}/callback"
var authResult : AuthResult?

Check failure on line 81 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L81 <standard:colon-spacing>

Unexpected spacing before ":"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:81:28: error: Unexpected spacing before ":" (standard:colon-spacing)
val client = OkHttpClient()
val moshi = Moshi.Builder()

Check failure on line 83 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L83 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:83:25: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)

Check failure on line 83 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L83 <standard:chain-method-continuation>

Expected newline before '.'
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:83:30: error: Expected newline before '.' (standard:chain-method-continuation)
.build()
val jsonAdapter = moshi.adapter(OIDCResponse::class.java)
val mediaType = "application/json; charset=utf-8".toMediaType()
val requestBody = "{\"code\":\"$code\"}".toRequestBody(mediaType)

val params = listOf(

Check failure on line 89 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L89 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:89:26: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
"grant_type" to "authorization_code",
"code" to code,
"client_id" to Passage.appId,
"verifier" to verifier,
"client_secret" to Passage.clientID,
"redirect_uri" to redirectUri

Check failure on line 95 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L95 <standard:trailing-comma-on-call-site>

Missing trailing comma before ")"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:95:46: error: Missing trailing comma before ")" (standard:trailing-comma-on-call-site)
).joinToString("&") { (key, value) ->
"$key=${URLEncoder.encode(value, "UTF-8")}"
}

val url = "${Passage.BASE_PATH_OIDC}/token?$params"
val request = Request.Builder()

Check failure on line 101 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L101 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:101:27: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)

Check failure on line 101 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L101 <standard:chain-method-continuation>

Expected newline before '.'
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:101:34: error: Expected newline before '.' (standard:chain-method-continuation)
.url(url)
.post(requestBody)
.build()

withContext(Dispatchers.IO) {
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
if (response.code == 500)
throw ServerException("Server error : ${response.code} ${response.message}", response.code)

Check failure on line 110 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L110 <standard:multiline-if-else>

Missing { ... }
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:110:29: error: Missing { ... } (standard:multiline-if-else)
throw ClientException("Client error : ${response.code} ${response.message}", response.code)
}
val responseBody = response.body?.string()
if (responseBody != null) {
val apiResponse = jsonAdapter.fromJson(responseBody)!!
authResult = AuthResult(

Check failure on line 116 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L116 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:116:38: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
authToken = apiResponse.access_token,
redirectUrl = "",
refreshToken = apiResponse.refresh_token,
refreshTokenExpiration = null

Check failure on line 120 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L120 <standard:trailing-comma-on-call-site>

Missing trailing comma before ")"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:120:58: error: Missing trailing comma before ")" (standard:trailing-comma-on-call-site)
)

Check failure on line 122 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L122 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:122:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
else

Check failure on line 124 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L124 <standard:keyword-spacing>

Unexpected newline before "else"
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:124:21: error: Unexpected newline before "else" (standard:keyword-spacing)
throw Exception("Response body is null : ${response.code} ${response.message}")

Check failure on line 125 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L125 <standard:if-else-bracing>

All branches of the if statement should be wrapped between braces if at least one branch is wrapped between braces
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:125:25: error: All branches of the if statement should be wrapped between braces if at least one branch is wrapped between braces (standard:if-else-bracing)

Check failure on line 125 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L125 <standard:multiline-if-else>

Missing { ... }
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:125:25: error: Missing { ... } (standard:multiline-if-else)
}
}
return authResult
}
}
}

@JsonClass(generateAdapter = true)
data class OIDCResponse(val access_token: String, val refresh_token: String?)

Check failure on line 134 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L134 <standard:class-signature>

Newline expected after opening parenthesis
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:134:25: error: Newline expected after opening parenthesis (standard:class-signature)

Check failure on line 134 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L134 <standard:class-signature>

Parameter should start on a newline
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:134:51: error: Parameter should start on a newline (standard:class-signature)

Check failure on line 134 in passage/src/main/java/id/passage/android/PassageOIDC.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/PassageOIDC.kt#L134 <standard:class-signature>

Newline expected before closing parenthesis
Raw output
passage/src/main/java/id/passage/android/PassageOIDC.kt:134:77: error: Newline expected before closing parenthesis (standard:class-signature)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@file:Suppress("RedundantVisibilityModifier")

package id.passage.android.exceptions

import id.passage.client.infrastructure.ClientException
import id.passage.client.infrastructure.ServerException

/**
* Thrown when there's an error finishing OIDC login/sign up
*
* @see FinishOIDCException
*/
public open class FinishOIDCException(message: String) : PassageException(message) {

Check failure on line 13 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L13 <standard:class-signature>

Newline expected after opening parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:13:39: error: Newline expected after opening parenthesis (standard:class-signature)

Check failure on line 13 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L13 <standard:class-signature>

Newline expected before closing parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:13:54: error: Newline expected before closing parenthesis (standard:class-signature)
internal companion object {
internal fun convert(e: Exception): FinishOIDCException {
val message = e.message ?: e.toString()
return when (e) {
is ClientException -> convertClientException(e)
is ServerException -> FinishOIDCServerException(message)
else -> FinishOIDCException(message)
}
}

private fun convertClientException(e: ClientException): FinishOIDCException {

Check failure on line 24 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L24 <standard:function-expression-body>

Function body should be replaced with body expression
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:24:85: error: Function body should be replaced with body expression (standard:function-expression-body)
return when (e.statusCode.toString()) {
"400" -> {
FinishOIDCBadRequestException(e.message.toString())
}
else -> {
FinishOIDCException(e.message.toString())
}
}
}
}
}

/**
* Thrown when server returns bad request due to the invalid info.
*/
public class FinishOIDCBadRequestException(message: String) : FinishOIDCException(message)

Check failure on line 40 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L40 <standard:class-signature>

Newline expected after opening parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:40:44: error: Newline expected after opening parenthesis (standard:class-signature)

Check failure on line 40 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L40 <standard:class-signature>

Newline expected before closing parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:40:59: error: Newline expected before closing parenthesis (standard:class-signature)

/**
* Thrown when Passage internal server error occurs.
*/
public class FinishOIDCServerException(message: String) : FinishOIDCException(message)

Check failure on line 45 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L45 <standard:class-signature>

Newline expected after opening parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:45:40: error: Newline expected after opening parenthesis (standard:class-signature)

Check failure on line 45 in passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt#L45 <standard:class-signature>

Newline expected before closing parenthesis
Raw output
passage/src/main/java/id/passage/android/exceptions/FinishOIDCException.kt:45:55: error: Newline expected before closing parenthesis (standard:class-signature)

0 comments on commit fa2d3b3

Please sign in to comment.