GithubHelp home page GithubHelp logo

amco-cas's Introduction

Amco::Cas

This a drop-in engine to integrate amcoid(https://github.com/amco/amcoid) to amco apps

Usage

This gem exposes a route to the main app which can be used with:

= link_to amco_cas.logout_path, method: :delete

the following before actions

before_action :filter_amco_id, :require_user

are hooked into the ApplicationController to control access to the app

Installation

Add this line to your rails pplication's Gemfile:

gem 'rubycas-client-rails', git: 'https://github.com/amco/rubycas-client-rails', branch: '0.1'
gem 'amco-cas'

note: The 'rubycas-client-rails' gem has to be added to the host application since it's not published to rubygems it's not possible to use it inside the amco-cas engine gemspec

And then execute:

$ bundle install

Mount the engine in your application routes.rb file with:

mount Amco::Cas::Engine, at: 'amco_cas'

You will need to provide default values for the underlying RubyCas gem, this can be done in you application.rb file with:

config.before_initialize do
  config.rubycas.cas_base_url = ::Settings.amco_id.cas_base_url
  config.rubycas.enable_single_sign_out = ::Settings.amco_id.enable_single_sign_out
  config.rubycas.ticket_store = Amco::Cas::RedisTicketStore
  config.rubycas.username_session_key = ::Settings.amco_id.username_session_key.to_sym
  Amco::Cas.settings_class_name = 'YourAppSettings'
  Amco::Cas.config(config.rubycas)
end

Current User

you should add the following snippet to expose the current_user method from the engine

helper_method :current_user

to override or decorate the current user object you can do the following in you application_controller :

def current_user
  OpenStruct.new(user: super, context: { role: 'av_admin' } )
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.

amco-cas's People

Contributors

dependabot[bot] avatar erickfabian avatar javierg avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amco-cas's Issues

Unpermited parameters :commit, :utf8

When submiting a form, the App crashes with an error on unpermited parameters.
Seems thah the issue is on:

        def cas_params
          params.permit(:logoutRequest, :ticket, :renew, :id)
        end

as this is evaluated before the specific controllers permit params methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.