Soft migrating to auth (#309)
This commit is contained in:
@@ -35,7 +35,7 @@ class AuthRpc(
|
|||||||
Mono.error(it)
|
Mono.error(it)
|
||||||
} else {
|
} else {
|
||||||
val message = "Internal error: ${it.message}"
|
val message = "Internal error: ${it.message}"
|
||||||
log.error(message, it)
|
log.error(message)
|
||||||
Mono.error(
|
Mono.error(
|
||||||
Status.INTERNAL
|
Status.INTERNAL
|
||||||
.withDescription(message)
|
.withDescription(message)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import io.emeraldpay.dshackle.auth.processor.SESSION_ID
|
|||||||
import io.emeraldpay.dshackle.auth.processor.VERSION
|
import io.emeraldpay.dshackle.auth.processor.VERSION
|
||||||
import io.emeraldpay.dshackle.auth.service.RsaKeyReader
|
import io.emeraldpay.dshackle.auth.service.RsaKeyReader
|
||||||
import io.emeraldpay.dshackle.config.AuthorizationConfig
|
import io.emeraldpay.dshackle.config.AuthorizationConfig
|
||||||
|
import io.grpc.Status
|
||||||
|
import io.grpc.StatusRuntimeException
|
||||||
import reactor.core.publisher.Mono
|
import reactor.core.publisher.Mono
|
||||||
import java.security.interfaces.RSAPrivateKey
|
import java.security.interfaces.RSAPrivateKey
|
||||||
import java.security.interfaces.RSAPublicKey
|
import java.security.interfaces.RSAPublicKey
|
||||||
@@ -34,7 +36,12 @@ class GrpcUpstreamsAuth(
|
|||||||
).map {
|
).map {
|
||||||
verify(it.providerToken, providerId)
|
verify(it.providerToken, providerId)
|
||||||
}.onErrorResume {
|
}.onErrorResume {
|
||||||
Mono.just(AuthResult(false, "Error during auth - ${it.message}"))
|
if (it is StatusRuntimeException && it.status.code == Status.Code.UNIMPLEMENTED) {
|
||||||
|
Mono.just(AuthResult(true))
|
||||||
|
.also { grpcAuthContext.putTokenInContext(providerId, SESSION_ID) }
|
||||||
|
} else {
|
||||||
|
Mono.just(AuthResult(false, "Error during auth - ${it.message}"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user