class Doorkeeper::OAuth::PasswordAccessTokenRequest
def before_successful_response
def before_successful_response find_or_create_access_token(client, resource_owner, scopes, {}, server) super end
def initialize(server, client, credentials, resource_owner, parameters = {})
def initialize(server, client, credentials, resource_owner, parameters = {}) @server = server @resource_owner = resource_owner @client = client @credentials = credentials @parameters = parameters @original_scopes = parameters[:scope] @grant_type = Doorkeeper::OAuth::PASSWORD end
def validate_client
- See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.3 -
def validate_client if Doorkeeper.config.skip_client_authentication_for_password_grant client.present? || (!parameters[:client_id] && credentials.blank?) else client.present? end end
def validate_client_supports_grant_flow
def validate_client_supports_grant_flow Doorkeeper.config.allow_grant_flow_for_client?(grant_type, client&.application) end
def validate_resource_owner
def validate_resource_owner resource_owner.present? end
def validate_scopes
def validate_scopes return true if scopes.blank? ScopeChecker.valid?( scope_str: scopes.to_s, server_scopes: server.scopes, app_scopes: client.try(:scopes), grant_type: grant_type, ) end