0.4.7 • Published 2 months ago

@onenessdt/testcontainers-keycloak v0.4.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Testcontainers-Keycloak

A testcontainers for keycloak

https://www.npmjs.com/package/testcontainers-keycloak

Installation

npm i -D testcontainers-keycloak

Usage

// start a keycloak container
const keycloak = await new KeycloakContainer()
    .withAdminUsername('admin')
    .withAdminPassword('admin')
    .withExposedPorts(8080)
    .start()

// start a admin session
await keycloak.configCredentials('master', 'admin', 'admin')

// according to your scenarios
// create the realm, user and client
await keycloak.createRealm('demo')
await keycloak.createUser('demo', 'user01', 'yubin', 'hsu', true)
await keycloak.createClient(
      'demo',
      'client01',
      'client01Secret',
      ['http://localhost:8888', 'http://localhost:8888/callback'],
      ['http://localhost:8888/home']
    )

// your test case ...
const accessToken = await keycloak.getAccessToken('demo', 'user01', 'user01password', 'client01', 'client01Secret')
0.4.7

2 months ago

0.4.5

2 months ago

0.4.4

2 months ago

0.4.6

2 months ago

0.4.3

2 months ago

0.4.2

2 months ago

0.4.1

2 months ago

0.4.0

2 months ago