OAuthServerMock

class OAuthServerMock(hostname: String, port: Int)

OAuth Server Mock.

This class mocks an oauth2 server, by generating valid signed JWTs. The class also provides the endpoint from where the public keys can be downloaded.

Parameters

hostname

the Host name, defaults to "localhost".

port

the Host port number. A port number of zero will let the system pick up an ephemeral port in a bind operation, defaults to 0.

Constructors

Link copied to clipboard
fun OAuthServerMock(hostname: String = "localhost", port: Int = 0)

Functions

Link copied to clipboard
fun generateJWT(claims: Map<String, Any>): String

Generate a signed JWT with the supplied claims. The only claims automatically included are: nbf and exp

Link copied to clipboard
fun getJwksUri(): URI

Returns the URI for JWKS.

Link copied to clipboard
fun shutdown()

Stops the mocked oauth server.

Link copied to clipboard
fun start()

Starts the mocked oauth server.

Properties

Link copied to clipboard
val hostname: String
Link copied to clipboard
val port: Int = 0