# Oauth2Token routing definition
entity.oauth2_token.canonical:
  path: '/admin/config/people/simple_oauth/oauth2_token/{oauth2_token}'
  defaults:
    _entity_view: 'oauth2_token'
    _title: 'Access Token'
  requirements:
    _entity_access: 'oauth2_token.view'
  options:
    _admin_route: TRUE

entity.oauth2_token.collection:
  path: '/admin/config/people/simple_oauth/oauth2_token'
  defaults:
    _entity_list: 'oauth2_token'
    _title: 'Access Token list'
  requirements:
    _permission: 'administer simple_oauth entities'
  options:
    _admin_route: TRUE
  base_route: system.admin_content

entity.oauth2_token.delete_form:
  path: '/admin/config/people/simple_oauth/oauth2_token/{oauth2_token}/delete'
  defaults:
    _entity_form: oauth2_token.delete
    _title: 'Delete Access Token'
  requirements:
    _entity_access: 'oauth2_token.delete'
  options:
    _admin_route: TRUE

oauth2_token.settings:
  path: '/admin/config/people/simple_oauth'
  defaults:
   _form: '\Drupal\simple_oauth\Entity\Form\Oauth2TokenSettingsForm'
   _title: 'Simple OAuth Settings'
  requirements:
    _permission: 'administer simple_oauth entities'
  options:
    _admin_route: TRUE
  base_route: entity.user.admin_form

oauth2_token.settings.generate_key:
  path: '/admin/config/people/simple_oauth/generate_key'
  defaults:
    _title: 'Generate Key Form'
    _controller: 'Drupal\simple_oauth\Controller\Oauth2GenerateKey::generateKeysModalAjaxResponse'
  requirements:
    _permission: 'administer simple_oauth entities'
  options:
    _admin_route: TRUE

oauth2_token.token:
  path: '/oauth/token'
  defaults:
    _controller: 'Drupal\simple_oauth\Controller\Oauth2Token::token'
  methods: [POST]
  requirements:
    _access: 'TRUE'
oauth2_token.authorize:
  path: '/oauth/authorize'
  defaults:
    _controller: 'Drupal\simple_oauth\Controller\Oauth2AuthorizeController::authorize'
    _title: 'Grant Access to Client'
  methods: [GET, POST]
  requirements:
    _access: 'TRUE'
  options:
    no_cache: TRUE

oauth2_token.user_debug:
  path: '/oauth/debug'
  defaults:
    _controller: 'Drupal\simple_oauth\Controller\DebugController::debug'
  methods: [GET]
  requirements:
    _permission: 'debug simple_oauth tokens'
    _format: 'json'
  options:
    _auth: ['oauth2']
    no_cache: TRUE

simple_oauth.userinfo:
  path: '/oauth/userinfo'
  defaults:
    _controller: Drupal\simple_oauth\Controller\UserInfo::handle
    _title: 'OpenID Connect User Info'
  methods: [GET, POST]
  requirements:
    _role: 'authenticated'
  options:
    _auth: ['oauth2']
simple_oauth.jwks:
  path: '/oauth/jwks'
  defaults:
    _controller: Drupal\simple_oauth\Controller\Jwks::handle
    _title: 'OpenID Connect Key Store Info (JSON)'
  methods: [GET]
  requirements:
    _role: 'authenticated'
  options:
    _auth: ['oauth2']

simple_oauth.settings.openid_connect:
  path: '/admin/config/people/simple_oauth/openid-connect'
  defaults:
    _form: '\Drupal\simple_oauth\Form\OpenIdConnectSettingsForm'
    _title: 'OpenID Connect'
  requirements:
    _permission: 'administer simple_oauth entities'
  options:
    _admin_route: TRUE
  base_route: oauth2_token.settings
