[Openid-specs-ab] Online Access Refresh Tokens
david at alkaline-solutions.com
Sun Dec 22 08:03:31 UTC 2019
A number of comments.
There are issues with the way that offline access is defined today. I think a number of these also translate to an online access scope, plus a few additional issues.
First, offline_access is unfortunately defined tied to refresh tokens, when no _actual_ protocol tie is present (nor is the use of refresh tokens in offline access patterns a MUST).
I can have refresh tokens in an authorization tied to the OP concept of a user session. Likewise, I can issue a non-time-limited access token for a confidential client to use, without a refresh token and with expiry only being via some external process. The definition of offline_access has caused unfortunate confusion by implementors, who believe refresh tokens are somehow incompatible with tying authentication to a user session, and that refresh tokens are required for independent access.
However, I don’t believe this requires a new scope name. Rather, this could be solved with clarifying how offline_access may be applied outside the context of OpenID Connect.
Secondly (and IMHO), use of offline_access itself is an anti-pattern for some deployments. A single client’s behavior within the system will almost never dynamic enough to need offline behavior for a user in one case, and session-bound behavior in another. Generically expecting clients to indicate whether they need offline behavior is a sign that clients in the environment are not properly classified or audited for their actual needs. The only AS/OP environments where this really is acceptable is when you expect users to be the sole line of defense against inappropriate requests by clients for permissions - but even large social providers like Facebook and GitHub have started to decide this is unacceptable.
Finally, (and also IMHO) while I understand the modeling of online_access to be explicit that underspecified clients should have any refresh tokens bound to the session, I don’t believe a scope is appropriate way to model a client opting into _limitations_ on the authorization. Other scopes when requested increase the capabilities of the token or the information the client has access to - access to authentication information and user claims with most of the OIDC-defined scopes, access to additional API capabilities with typical OAuth scopes. In this case, clients would be opting into having to send the user through an authorization UX more often - which is not something I see a client developer normally seeking out how to do.
As part of the overall authentication and authorization policy this is all the responsibility of the OP to dictate. It is not appropriate for the client to opt into behavior based on its own self-assertion around security and design.
I further assert that in the rare cases where it is appropriate for a client to indicate off-line or on-line patterns for access, these are the only two apparent policy options which could be broadly standardized. In that case, the absence of an offline_access scope is the same as some online_access scope.
> On Dec 21, 2019, at 12:24 PM, Karl McGuinness via Openid-specs-ab <openid-specs-ab at lists.openid.net> wrote:
> https://gist.github.com/mcguinness/85116690d556f8ddf280143469063a6c <https://gist.github.com/mcguinness/85116690d556f8ddf280143469063a6c>
> Online Access Refresh Tokens <https://gist.github.com/mcguinness/85116690d556f8ddf280143469063a6c>
> Online Access Refresh Tokens. GitHub Gist: instantly share code, notes, and snippets.
> gist.github.com <http://gist.github.com/>Hello OpenID Connect WG,
> I hosted a session at IIW last fall discussing the need to introduce support for online_access refresh tokens. I promised to write up the takeaways and send to the OpenID Connect mailing list. I finally found the time before the year closes to complete that promise!
> Problem Statement
> The OAuth 2.0 Authorization Framework <https://tools.ietf.org/html/rfc6749> defines the authorization_code grant type and refresh token. It doesn't establish any rules for issuing refresh tokens and explicitly states in Section 1.5 <https://tools.ietf.org/html/rfc6749#section-1.5> that "Issuing a refresh token is optional at the discretion of the authorization server". One of the explicit goals for Rfc6749 was to enable offline access to protected resources when the end-user is not present. It does not define any request semantics for how a client can explicitly request a refresh token or whether that refresh token's lifecycle should be bound to the user's session that granted the refresh token. Authorization Servers are free to define these behaviors on a per-implementation or policy basis.
> OpenID Connect being the identity layer ontop of OAuth 2.0 needed to define some new authorization server behaviors to enable end-user consent for when a client can access their identity info (UserInfo). This resulted in a new scope offline_access <https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess> being defined to allow a client to access their identity info when they are not present.
> OPTIONAL. This scope value requests that an OAuth 2.0 Refresh Token be issued that can be used to obtain an Access Token that grants access to the End-User's UserInfo Endpoint even when the End-User is not present (not logged in).
> OpenID Connect 1.0 does not define how the offline_access scope should constrain access to other protected resources, nor does it define the behavior of the refresh token if this scope is not requested. Authorization Servers are free to define behaviors for other protected resources and/or non-OIDC defined scopes when offline_access is requested.
> The use of Refresh Tokens is not exclusive to the offline_access use case. The Authorization Server MAY grant Refresh Tokens in other contexts that are beyond the scope of this specification.
> There are many large scale OAuth 2.0 deployments the have chosen to only issue refresh tokens for delegated access to their protected non-identity resources only if offline_access scope is requested. This approach often simplified Authorization Server complexity and developer documentation by linking the offline_access OIDC constrain to all protected resources.
> OpenID Connect 1.0 also does not define any new behaviors for when an issued refresh tokens should be linked to the authentication session that issued the authorization code/refresh token. Logging out of the OP is an implementation-specific behavior with respect to any issued refresh tokens that were not requested with offline_access scope.
> This lack of clarity hasn't historically been a significant issue as refresh tokens were restricted from being issued via the implicitgrant in Section 4.2 <https://tools.ietf.org/html/rfc6749#section-4.2>. Refresh tokens were often only used for web or native clients where offline_access was the desired behavior (raison d'etre of OAuth 2.0)
> As developers shift to more browser-based applications (e.g Single Page Apps) and leverage cloud identity services, the need to resolve this undefined behavior has reached a tipping point. The OAuth 2.0 for Browser-Based Apps BCP <https://tools.ietf.org/html/draft-ietf-oauth-browser-based-apps-04> and OAuth 2.0 Security Best Current Practice BCP <https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13> deprecate the implicit grant and require all browser-based applications to use the authorization_code grant with PKCE. This change requires defining new behaviors for refresh tokens in the browser where it previously never was used. Section 8 <https://tools.ietf.org/html/draft-ietf-oauth-browser-based-apps-04#section-8>of the BCP defines security mitigations to prevent refresh tokens from being leaked but does not define what should happen if the user logs out of the authorization server.
> When browser-based apps used the implicit grant they often used patterns like making authentication requests with prompt=none to silently request new access tokens when previously issued access tokens were expired. This pattern relied on the client and the end-user being in the same browser context and having a session with the OP. Logout at OP would prevent these clients from obtaining new access tokens. This not only had security benefits but also user experience benefits especially when switching accounts at the OP.
> It is desirable to have an explicit pattern for a client to opt-in to a refresh token that is tightly coupled to the user's session at the Authorization Server. An explicit pattern enables the client to express it's intent on whether it wants to operate in a connected or disconnected mode. The Authorization Server can choose to honor this intent or not based on policy.
> The recommendation was to introduce a new online_access scope that when requested, binds the issued refresh token to user's session on the Authorization Server. If the user's session is closed or revoked either directly by end-user or indirectly by the Authorization Server such as an inactivity timeout policy the refresh token and children access tokens issued with the refresh token MUST be revoked by the Authorization Server.
> Revoking the issued refresh token directly via Token Revocation Endpoint or indirectly via the Authorization Server should only revoke the refresh token and children access tokens and not the user's session.
> If the need arises to revoke the user's session at the Authorization Server via the backchannel with a Refresh Token, then a new extension to Logout Specifications should be defined.
> The recommendation was to define the new online_access in OIDF as this is consistent with offline_access and relates to authentication concerns. Once defined in OIDF, we can reference in OAuth 2.0 for Browser-Based Apps BCP. We should maybe consider introducing a new client application_type (e.g. browser) that requires online_access scope.
> The healthcare domain has defined a similar use of online_access with the HL7 FHIR specifications <http://www.hl7.org/fhir/smart-app-launch/scopes-and-launch-context/index.html#scopes-for-requesting-a-refresh-token>.
> Openid-specs-ab mailing list
> Openid-specs-ab at lists.openid.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openid-specs-ab