Hydra::Keycloak::Client

Keycloak client for SSO implementation.

Installation

Add this line to your application's Gemfile:

gem 'hydra-keycloak-client'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install hydra-keycloak-client

Usage

Create client instance for usage:

keycloack_client = Hydra::Keycloak::ClientCreator.call(
  config: {
    auth_server_url:      keycloak_config.fetch(:auth_server_url),
    realm:                keycloak_config.fetch(:realm),
    client_id:            keycloak_config.fetch(:client_id),
    redirect_uri:         keycloak_config.fetch(:redirect_uri),
    secret:               keycloak_config.fetch(:secret),
    logout_redirect:      keycloak_config.fetch(:logout_redirect),
    store_client:         'redis',
    store_client_options: {redis_host: ENV['REDIS_HOST'], redis_port: ENV['REDIS_PORT']},
    scope:                ['hoper_scope', 'homs_scope']
  })

or for memcached:

   ...
    store_client:         'memcached',
    store_client_options: {
      memcached_host:           "localhost",
      memcached_port:           "11211",
      memcached_namespace:      "hoper",
    }