Navigation Menu

Skip to content
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

Merged
merged 29 commits into from Mar 3, 2021
Merged

Cased CLI integration #3

merged 29 commits into from Mar 3, 2021

Conversation

dewski
Copy link
Contributor

@dewski dewski commented Mar 2, 2021

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).

@@ -2,66 +2,67 @@ PATH
remote: .
specs:
cased-rails (0.3.1)
cased-ruby (~> 0.3.3)
cased-ruby (~> 0.4.0)
Copy link
Contributor Author

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? %>
Copy link
Contributor Author

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 %>
Copy link
Contributor Author

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
Copy link
Contributor Author

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' %>
Copy link
Contributor Author

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

@dewski dewski marked this pull request as ready for review March 2, 2021 23:48
@dewski dewski requested review from rikasun and tnm March 2, 2021 23:48
@dewski dewski self-assigned this Mar 2, 2021
Copy link

@rikasun rikasun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌🏼 🥳

@dewski dewski merged commit c6e7b3c into master Mar 3, 2021
@dewski dewski deleted the guard branch March 3, 2021 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants