Problem/Motivation

The "Oauth2GrantManager" responsibility should be limited how the grant type plugins are discovered and instantiated. Currently the plugin manager is also responsible for instantiating the authorization server via the ThePHPLeague/Oauth2-Server library. It would benefit the flexibility and maintainability to decouple this responsibility to a dedicated service.

With #3263590: Decouple the scope definition and provide static/dynamic scope providers and #3263611: Enhance/update consumer entity; we are introducing a new data model for scopes and clients/consumers, we need to implement these changes in the new authorization server service, update the associated controllers and League repositories/entities.

Proposed resolution

  • Migrate the "getAuthorizationServer" method logic from "Oauth2GrantManager" class to a dedicated "Authorization server" factory service; because we are supporting different grant types, access/refresh token expiration time by client/consumer.
  • Implement the new scope provider in the “Authorization server“.
    • Validate request based on supported scopes.
    • Validate client based on supported grant types.
    • Validate request on multiple redirect URIs.
    • Implement scope descriptions on the authorize form based on the grant type.
    • Expire access/refresh token based on consumer.
    • For the “Client credentials“ grant type, assign scopes and user based on the consumer.
    • “Remember previous approval” will be based on the consumer.
  • #3261247: Implement OAuth 2.0 Security Best Current Practice
  • Test coverage will be included.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bojan_dev created an issue. See original summary.

bojan_dev’s picture

Title: [meta] Split responsibility of the OauthGrantManager » Split responsibility of the OauthGrantManager
Version: 5.2.x-dev » 6.0.x-dev
Category: Plan » Feature request
bojan_dev’s picture

Title: Split responsibility of the OauthGrantManager » Create dedicated authorization server service and implement new (scope/consumer) data model
Issue summary: View changes

bojan_dev’s picture

Issue summary: View changes
Status: Active » Needs review

  • bojan_dev committed c234a23 on 6.0.x
    Issue #3263631: Create dedicated authorization server service and...
bojan_dev’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.