Class: RubyLLM::MCP::Auth::ServerMetadata
- Inherits:
-
Object
- Object
- RubyLLM::MCP::Auth::ServerMetadata
- Defined in:
- lib/ruby_llm/mcp/auth.rb
Overview
OAuth Authorization Server Metadata (RFC 8414)
Instance Attribute Summary collapse
-
#authorization_endpoint ⇒ Object
readonly
Returns the value of attribute authorization_endpoint.
-
#code_challenge_methods_supported ⇒ Object
readonly
Returns the value of attribute code_challenge_methods_supported.
-
#grant_types_supported ⇒ Object
readonly
Returns the value of attribute grant_types_supported.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#registration_endpoint ⇒ Object
readonly
Returns the value of attribute registration_endpoint.
-
#response_types_supported ⇒ Object
readonly
Returns the value of attribute response_types_supported.
-
#scopes_supported ⇒ Object
readonly
Returns the value of attribute scopes_supported.
-
#token_endpoint ⇒ Object
readonly
Returns the value of attribute token_endpoint.
Class Method Summary collapse
-
.from_h(data) ⇒ ServerMetadata
Deserialize from hash.
Instance Method Summary collapse
-
#initialize(issuer:, authorization_endpoint:, token_endpoint:, options: {}) ⇒ ServerMetadata
constructor
A new instance of ServerMetadata.
-
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported.
-
#to_h ⇒ Hash
Serialize to hash.
Constructor Details
#initialize(issuer:, authorization_endpoint:, token_endpoint:, options: {}) ⇒ ServerMetadata
Returns a new instance of ServerMetadata.
219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/ruby_llm/mcp/auth.rb', line 219 def initialize(issuer:, authorization_endpoint:, token_endpoint:, options: {}) @issuer = issuer @authorization_endpoint = @token_endpoint = token_endpoint @registration_endpoint = [:registration_endpoint] || ["registration_endpoint"] @scopes_supported = [:scopes_supported] || ["scopes_supported"] @response_types_supported = [:response_types_supported] || ["response_types_supported"] @grant_types_supported = [:grant_types_supported] || ["grant_types_supported"] @code_challenge_methods_supported = [:code_challenge_methods_supported] || ["code_challenge_methods_supported"] end |
Instance Attribute Details
#authorization_endpoint ⇒ Object (readonly)
Returns the value of attribute authorization_endpoint.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def @authorization_endpoint end |
#code_challenge_methods_supported ⇒ Object (readonly)
Returns the value of attribute code_challenge_methods_supported.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def code_challenge_methods_supported @code_challenge_methods_supported end |
#grant_types_supported ⇒ Object (readonly)
Returns the value of attribute grant_types_supported.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def grant_types_supported @grant_types_supported end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def issuer @issuer end |
#registration_endpoint ⇒ Object (readonly)
Returns the value of attribute registration_endpoint.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def registration_endpoint @registration_endpoint end |
#response_types_supported ⇒ Object (readonly)
Returns the value of attribute response_types_supported.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def response_types_supported @response_types_supported end |
#scopes_supported ⇒ Object (readonly)
Returns the value of attribute scopes_supported.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def scopes_supported @scopes_supported end |
#token_endpoint ⇒ Object (readonly)
Returns the value of attribute token_endpoint.
215 216 217 |
# File 'lib/ruby_llm/mcp/auth.rb', line 215 def token_endpoint @token_endpoint end |
Class Method Details
.from_h(data) ⇒ ServerMetadata
Deserialize from hash
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/ruby_llm/mcp/auth.rb', line 255 def self.from_h(data) = { registration_endpoint: data[:registration_endpoint] || data["registration_endpoint"], scopes_supported: data[:scopes_supported] || data["scopes_supported"], response_types_supported: data[:response_types_supported] || data["response_types_supported"], grant_types_supported: data[:grant_types_supported] || data["grant_types_supported"], code_challenge_methods_supported: data[:code_challenge_methods_supported] || data["code_challenge_methods_supported"] }.compact new( issuer: data[:issuer] || data["issuer"], authorization_endpoint: data[:authorization_endpoint] || data["authorization_endpoint"], token_endpoint: data[:token_endpoint] || data["token_endpoint"], options: ) end |
Instance Method Details
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported
233 234 235 |
# File 'lib/ruby_llm/mcp/auth.rb', line 233 def supports_registration? !@registration_endpoint.nil? end |
#to_h ⇒ Hash
Serialize to hash
239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/ruby_llm/mcp/auth.rb', line 239 def to_h { issuer: @issuer, authorization_endpoint: @authorization_endpoint, token_endpoint: @token_endpoint, registration_endpoint: @registration_endpoint, scopes_supported: @scopes_supported, response_types_supported: @response_types_supported, grant_types_supported: @grant_types_supported, code_challenge_methods_supported: @code_challenge_methods_supported }.compact end |