To install, add these two lines to your Gemfile:
gem "pivotal_auth", github: "pivotal/pivotal_auth"
gem "okta_saml", github: "pivotal/okta_saml", branch: "dev"
Add this line in your routes:
mount PivotalAuth::Engine, at: '/'
Make sure you also have a root route defined. This is where users will be redirected to after login, unless they have previously visited a page that requires authentication.
Run these lines:
bundle
rails g pivotal_auth:init
Ignore the "Missing okta_saml.yml file in Rails.root/config" warning.
The gem requires two env variables: OKTA_LOGIN_URL
and OKTA_CERT_FINGERPRINT
. These are specific to the Okta app you are authenticating against.
To get these values, follow the instructions under "Okta Configuration" and "Configuration". Step 1 of the "Configuration" instructions refers to OKTA_LOGIN_URL
. Step 2 of the instructions refers to OKTA_CERT_FINGERPRINT
.
- Login:
/login
- Logout:
/logout
current_user_email
- Returns the email of the currently logged in user.user_signed_in?
- Returns if a user is signed inauthenticate_user!
- A before filter that will redirect to '/login' if no user is signed in. It will also set a redirect url to the current path.