add tamper protection
This commit is contained in:
@@ -13,6 +13,7 @@ import io.ebean.config.DatabaseConfig
|
||||
import io.ebean.config.TenantMode
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMWriter
|
||||
import org.bouncycastle.util.io.pem.PemReader
|
||||
import org.jose4j.jwk.JsonWebKey
|
||||
import org.jose4j.jwk.PublicJsonWebKey
|
||||
import org.jose4j.jwk.RsaJsonWebKey
|
||||
import org.jose4j.jwk.RsaJwkGenerator
|
||||
@@ -108,7 +109,7 @@ object Session {
|
||||
|
||||
}
|
||||
|
||||
fun sign(payload: String): String {
|
||||
fun signPayload(payload: String): String {
|
||||
|
||||
// Create a new JsonWebSignature
|
||||
val jws = JsonWebSignature()
|
||||
@@ -161,6 +162,7 @@ object Session {
|
||||
fun currentUser() = currentUser.get().userName
|
||||
fun currentTenant() = currentUser.get().tenant
|
||||
fun currentRoles() = currentUser.get().roles
|
||||
fun jwk() = keypair.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)
|
||||
|
||||
fun Database.findByEntityAndId(entity: String, id: String): DataModel {
|
||||
return find(DataModel::class.java)
|
||||
|
||||
Reference in New Issue
Block a user