Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package co.nilin.opex.api.core.inout

enum class OTPType {

SMS, EMAIL,
SMS, EMAIL, TOTP, NONE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package co.nilin.opex.api.core.inout

enum class PairCategory {
REAL_ASSET_TOKEN,
FIAT,
CRYPTO
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ data class PairInfoResponse(
val minOrder : BigDecimal,
val maxOrder : BigDecimal,
val orderTypes : String,
val internalChart: Boolean,
val globalChart: Boolean,
val categories: List<PairCategory> = emptyList()
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ class PairSetting(
val maxOrder : BigDecimal,
val orderTypes : String,
val updateDate: LocalDateTime? = null,
val internalChart: Boolean,
val globalChart: Boolean,
val categories: List<PairCategory> = emptyList()

)
28 changes: 28 additions & 0 deletions api/api-core/src/main/kotlin/co/nilin/opex/api/core/inout/TOTP.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package co.nilin.opex.api.core.inout

data class SetupTOTPRequest(
val userId: String,
val label: String?
)

data class SetupTOTPResponse(
val uri: String
)

data class VerifyTOTPRequest(
val userId: String,
val code: String
)

data class VerifyTOTPResponse(val result: Boolean)

data class TOTPQueryResponse(
val userId: String,
val isEnabled: Boolean,
val isActivated: Boolean,
val uri : String
)

data class TOTPCode(
val code: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.nilin.opex.api.core.inout

import com.fasterxml.jackson.annotation.JsonInclude

data class TwoFactorRequest(
val method: OTPType,
)

data class ConfirmTwoFactorRequest(
val method: OTPType,
val otp: String,
)

@JsonInclude(JsonInclude.Include.NON_NULL)
data class TwoFactorResponse(val otp: String?, val otpReceiver: OTPReceiver?)
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package co.nilin.opex.api.core.spi

import co.nilin.opex.api.core.inout.ConfirmTwoFactorRequest
import co.nilin.opex.api.core.inout.OTPType
import co.nilin.opex.api.core.inout.SetupTOTPResponse
import co.nilin.opex.api.core.inout.TOTPCode
import co.nilin.opex.api.core.inout.TwoFactorRequest
import co.nilin.opex.api.core.inout.TwoFactorResponse
import co.nilin.opex.api.core.inout.auth.*

interface AuthProxy {
Expand All @@ -22,4 +28,12 @@ interface AuthProxy {
suspend fun logoutOthers(token: String)
suspend fun logoutAll(token: String)

suspend fun getTwoFactorConfig(token: String): OTPType
suspend fun requestEnableTwoFactor(request: TwoFactorRequest, token: String): TwoFactorResponse
suspend fun confirmEnableTwoFactor(request: ConfirmTwoFactorRequest, token: String): OTPVerifyResponse
suspend fun requestDisableTwoFactor(request: TwoFactorRequest, token: String): TwoFactorResponse
suspend fun confirmDisableTwoFactor(request: ConfirmTwoFactorRequest, token: String): OTPVerifyResponse
suspend fun setupTOTP(token: String): SetupTOTPResponse
suspend fun verifyTOTPSetup(request: TOTPCode, token: String)

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class SecurityConfig(
// Opex endpoints
.pathMatchers("/opex/v1/oauth/protocol/openid-connect/**").permitAll()
.pathMatchers("/opex/v1/oauth.***").permitAll()
.pathMatchers("/opex/v1/user/2fa/**").authenticated()
.pathMatchers("/opex/v1/user/public/**").permitAll()
.pathMatchers("/opex/v1/user/update/**").permitAll()
.pathMatchers("/v1/deposit/webhook").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import org.springframework.beans.factory.annotation.Value
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.*
import java.math.BigDecimal
import java.time.ZoneId

Expand Down Expand Up @@ -104,7 +100,11 @@ Response body:
isAvailable = isAvailable,
minOrder = minOrder,
maxOrder = maxOrder,
orderTypes = orderTypes
orderTypes = orderTypes,
internalChart = internalChart,
globalChart = globalChart,
categories = categories

)
}
}
Expand Down
Loading
Loading