Class: RailsKeycloakAuthorization::ScopesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsKeycloakAuthorization::ScopesController
- Includes:
- WithHtmxLayout, WithKeycloakAdmin
- Defined in:
- app/controllers/rails_keycloak_authorization/scopes_controller.rb
Instance Method Summary collapse
Methods included from WithKeycloakAdmin
Instance Method Details
#attach ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/rails_keycloak_authorization/scopes_controller.rb', line 35 def attach keycloak_scope_name = params[:keycloak_scope_name] keycloak_resource_id = params[:keycloak_resource_id] KeycloakAdminRubyAgent.attach_scope_to_resource(keycloak_scope_name, keycloak_resource_id) redirect_to scope_path("scope", keycloak_resource_id: keycloak_resource_id, keycloak_scope_name: keycloak_scope_name) end |
#create ⇒ Object
43 44 45 46 |
# File 'app/controllers/rails_keycloak_authorization/scopes_controller.rb', line 43 def create scope = KeycloakAdminRubyAgent.create_keycloak_scope(params[:keycloak_scope_name]) redirect_to scope_path(scope.id, keycloak_resource_id: params[:keycloak_resource_id], keycloak_scope_name: params[:keycloak_scope_name]) end |
#index ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/rails_keycloak_authorization/scopes_controller.rb', line 6 def index @scopes = KeycloakAdmin .realm(realm_name) .authz_scopes(openid_client.id, params[:keycloak_resource_id]) .list end |
#new ⇒ Object
30 31 32 33 |
# File 'app/controllers/rails_keycloak_authorization/scopes_controller.rb', line 30 def new @keycloak_scope_name = params[:keycloak_scope_name] @keycloak_resource_id = params[:keycloak_resource_id] end |
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/rails_keycloak_authorization/scopes_controller.rb', line 13 def show @keycloak_scope_name = params[:keycloak_scope_name] @keycloak_resource_id = params[:keycloak_resource_id] @available_scope = KeycloakAdmin .realm(realm_name) .authz_scopes(openid_client.id) .search(params[:keycloak_scope_name]) .first @resource_scope = KeycloakAdmin .realm(realm_name) .authz_scopes(openid_client.id, params[:keycloak_resource_id]) .list .detect{|s| s.name == params[:keycloak_scope_name]} end |