Class: MCPClient::Auth::ServerMetadata
- Inherits:
-
Object
- Object
- MCPClient::Auth::ServerMetadata
- Defined in:
- lib/mcp_client/auth.rb
Overview
OAuth authorization server metadata
Instance Attribute Summary collapse
-
#authorization_endpoint ⇒ Object
readonly
Returns the value of attribute authorization_endpoint.
-
#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
Create server metadata from hash.
Instance Method Summary collapse
-
#initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil) ⇒ ServerMetadata
constructor
A new instance of ServerMetadata.
-
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported.
-
#to_h ⇒ Hash
Convert to hash.
Constructor Details
#initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil) ⇒ ServerMetadata
208 209 210 211 212 213 214 215 216 217 |
# File 'lib/mcp_client/auth.rb', line 208 def initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil) @issuer = issuer @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 end |
Instance Attribute Details
#authorization_endpoint ⇒ Object (readonly)
Returns the value of attribute authorization_endpoint.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def @authorization_endpoint end |
#grant_types_supported ⇒ Object (readonly)
Returns the value of attribute grant_types_supported.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def grant_types_supported @grant_types_supported end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def issuer @issuer end |
#registration_endpoint ⇒ Object (readonly)
Returns the value of attribute registration_endpoint.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def registration_endpoint @registration_endpoint end |
#response_types_supported ⇒ Object (readonly)
Returns the value of attribute response_types_supported.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def response_types_supported @response_types_supported end |
#scopes_supported ⇒ Object (readonly)
Returns the value of attribute scopes_supported.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def scopes_supported @scopes_supported end |
#token_endpoint ⇒ Object (readonly)
Returns the value of attribute token_endpoint.
198 199 200 |
# File 'lib/mcp_client/auth.rb', line 198 def token_endpoint @token_endpoint end |
Class Method Details
.from_h(data) ⇒ ServerMetadata
Create server metadata from hash
242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/mcp_client/auth.rb', line 242 def self.from_h(data) new( issuer: data[:issuer] || data['issuer'], authorization_endpoint: data[:authorization_endpoint] || data['authorization_endpoint'], token_endpoint: data[:token_endpoint] || data['token_endpoint'], 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'] ) end |
Instance Method Details
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported
221 222 223 |
# File 'lib/mcp_client/auth.rb', line 221 def supports_registration? !@registration_endpoint.nil? end |
#to_h ⇒ Hash
Convert to hash
227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/mcp_client/auth.rb', line 227 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 }.compact end |