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

🎁 Adding WorkAuthorization model for CDL #647

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Aug 4, 2023

Note: This is the "how do we give and revoke access" not the "when do I give and revoke"; that is something determined during user authentication and is partially dependent on the SSO work. However, this highlights the underlying logic to authorize and revoke user's read rights for given works.

🎁 Adding WorkAuthorization model for CDL

98cc8aa

With this commit, we're adding a mechanism to "lend" folks books. This
change accounts for granting a user read rights to a work.

It does not introduce the logic/functionality that "authorizes" or
"revokes" this loaned resource. With this commit, there are no changed
production logic paths.

Related to:

Co-authored-by: Summer Cook [email protected]

🎁 Adding logic for handling user signin

220524d

With this change, we're adding the logic for handling a user
authenticating:

  • namely expiring any authorizations that are "expired"
  • re-authorizing any work_pids that were provided as part of
    authentication.

Related to:

@jeremyf jeremyf force-pushed the 633-controlled-digital-lending branch 6 times, most recently from c099405 to 13d35b5 Compare August 7, 2023 16:01
With this commit, we're adding a mechanism to "lend" folks books.  This
change accounts for granting a user read rights to a work.

It does not introduce the logic/functionality that "authorizes" or
"revokes" this loaned resource.  With this commit, there are no changed
production logic paths.

Related to:

- #633

Co-authored-by: Summer Cook <[email protected]>
@jeremyf jeremyf force-pushed the 633-controlled-digital-lending branch from 13d35b5 to 98cc8aa Compare August 7, 2023 16:01
jeremyf added a commit that referenced this pull request Aug 7, 2023
With this change, we're adding the logic for handling a user
authenticating:

- namely expiring any authorizations that are "expired"
- re-authorizing any work_pids that were provided as part of
  authentication.

Related to:

- #633
- #647
With this change, we're adding the logic for handling a user
authenticating:

- namely expiring any authorizations that are "expired"
- re-authorizing any work_pids that were provided as part of
  authentication.

Related to:

- #633
- #647
@jeremyf jeremyf force-pushed the 633-controlled-digital-lending branch from 220524d to 68f644c Compare August 7, 2023 17:02
@jeremyf jeremyf merged commit 2e1aec1 into main Aug 7, 2023
7 checks passed
@jeremyf jeremyf deleted the 633-controlled-digital-lending branch August 7, 2023 19:43
@alishaevn alishaevn linked an issue Aug 7, 2023 that may be closed by this pull request
1 task
jeremyf added a commit that referenced this pull request Aug 21, 2023
With this change, we're adding the logic for handling a user
authenticating:

- namely expiring any authorizations that are "expired"
- re-authorizing any work_pids that were provided as part of
  authentication.

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 29, 2023
With this change, we're adding the logic for handling a user
authenticating:

- namely expiring any authorizations that are "expired"
- re-authorizing any work_pids that were provided as part of
  authentication.

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Aug 31, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 5, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 6, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

And once they login for the CDL asset, we redirect to that asset.

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
jeremyf added a commit that referenced this pull request Sep 13, 2023
Prior to this commit, we had not wired in the logic for authorization to
controlled digital lending (CDL) assets.  With this change, we're adding
the logic for handling a user authenticating to access a work.

The logic flow is as follows:

An unauthenticated user goes to a CDL asset page.  They are neither
authorized nor authenticated, so we direct them to the new session
route.  There we capture we're the URL of the requested resource and
send them on their way to authenticate.

When we perform the handshake with OpenID, we provide (as scope and
client design decision) the URL of the CDL asset.  The OpenID provider
authenticates and returns to the OmniAuth callback.  We use the returned
scope to then grant authorization to the CDL asset (and revoke any
expired authorizations).

And once they login for the CDL asset, we redirect to that asset.

Related to:

- #633
- #647
jeremyf added a commit that referenced this pull request Sep 13, 2023
We are trying to serve two types of users:

- Admins
- Not-admins

Given that admins are a small subset, we can train and document how they
can sign in.  In other words, favor workflows that impact the less
trained folk to help them accomplish their tasks.

Prior to this commit, given the site had an SSO provider, when I (an
unauthenticated user) went to a private work, then it would redirect me
to the `/user/sign_in` route.

At that route I had the following option:

1. Providing a username and password
2. Selecting one of the SSO providers to use for sign-in.

The problem with this behavior was that a user who was given a
Controlled Digital Lending (CDL) URL would see a username/password and
likely attempt to authenticate with their CDL username/password (which
was managed by the SSO provider).

The end result is that the authentication page most likely would create
confusion.

With this commit, I'm setting things up such that when the application
uses calls `new_user_session_path` we make a decision on what URL to
resolve.

Related to:

- #766
- #647
- #633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReShare - Set up a work lease for authenticated user
2 participants