Added User to AuthenticatedAction
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package utils
|
||||
|
||||
import java.nio.ByteBuffer
|
||||
import java.security.SecureRandom
|
||||
import java.util.Base64
|
||||
|
||||
object Random {
|
||||
private lazy val random = SecureRandom()
|
||||
private lazy val base64 = Base64.getEncoder
|
||||
|
||||
def randomBase64(bytes: Int): String = {
|
||||
val tokenRaw = ByteBuffer.allocate(bytes)
|
||||
random.nextBytes(tokenRaw.array())
|
||||
base64.encodeToString(tokenRaw.array())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user