New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cased CLI integration #3
Conversation
@@ -2,66 +2,67 @@ PATH | |||
remote: . | |||
specs: | |||
cased-rails (0.3.1) | |||
cased-ruby (~> 0.3.3) | |||
cased-ruby (~> 0.4.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump cased-ruby
to the new version we just published.
@@ -0,0 +1,15 @@ | |||
<div id="guard-session-container"> | |||
<% if guard_session.requested? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all the steps a Guard Session can go through and their respective views for each one.
<% elsif guard_session.reason_required? %> | ||
<%= render 'cased/cli/sessions/steps/reason_required', guard_session: guard_session %> | ||
<% else %> | ||
<%= render 'cased/cli/sessions/steps/create', guard_session: guard_session %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The create step is special in that we need to preserve any form parameters even when unauthenticated, we submit the hidden form to render either the requested
, reason_required
, or denied
/canceled
/timed_out
state.
@@ -0,0 +1,27 @@ | |||
json.id guard_session.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This view is used when polling for the approved/denied/timed out/canceled state.
</div> | ||
<div id="cased-logged-out" class="<%= 'hidden' if cased_authorization? %>"> | ||
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10"> | ||
<%= link_to 'Sign in to Cased', "#{Cased.config.url}/login/connect/#{Cased.config.guard_application_key}?return_to=#{cased.authorizations_url}", id: 'cased-authenticate', class: 'w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500' %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL ends up looking like:
https://app.cased.com/login/connect/guard_application_1234?return_to=https://admin.application.com/cased/authorizations/callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🏼 🥳
This PR wires up
cased-rails
with our Cased CLI approval flow. It includes support for authenticating with Cased, reason being required, session not approved, timed out, or canceled. If the application is configured to record sessions,rails console
will record playback for non-development or test environments (configurable of course).