Class: OAuth2::MCP::BearerChallenge
- Inherits:
-
Object
- Object
- OAuth2::MCP::BearerChallenge
- Defined in:
- lib/oauth2/mcp.rb
Overview
Formats WWW-Authenticate Bearer challenges for MCP HTTP responses.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_description ⇒ Object
readonly
Returns the value of attribute error_description.
-
#resource_metadata ⇒ Object
readonly
Returns the value of attribute resource_metadata.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(resource_metadata:, scope: nil, error: nil, error_description: nil) ⇒ BearerChallenge
constructor
A new instance of BearerChallenge.
-
#to_header ⇒ Object
Constructor Details
#initialize(resource_metadata:, scope: nil, error: nil, error_description: nil) ⇒ BearerChallenge
Returns a new instance of BearerChallenge.
541 542 543 544 545 546 |
# File 'lib/oauth2/mcp.rb', line 541 def initialize(resource_metadata:, scope: nil, error: nil, error_description: nil) @resource_metadata = .to_s @scope = scope @error = error @error_description = error_description end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
539 540 541 |
# File 'lib/oauth2/mcp.rb', line 539 def error @error end |
#error_description ⇒ Object (readonly)
Returns the value of attribute error_description.
539 540 541 |
# File 'lib/oauth2/mcp.rb', line 539 def error_description @error_description end |
#resource_metadata ⇒ Object (readonly)
Returns the value of attribute resource_metadata.
539 540 541 |
# File 'lib/oauth2/mcp.rb', line 539 def @resource_metadata end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
539 540 541 |
# File 'lib/oauth2/mcp.rb', line 539 def scope @scope end |
Instance Method Details
#to_header ⇒ Object
548 549 550 551 552 553 554 555 556 557 |
# File 'lib/oauth2/mcp.rb', line 548 def to_header parameters = { resource_metadata: , scope: format_scope(scope), error: error, error_description: error_description, }.compact "Bearer #{parameters.map { |key, value| %(#{key}="#{escape(value)}") }.join(", ")}" end |