Class: OIDCProvider::TokenEndpoint
- Inherits:
-
Object
- Object
- OIDCProvider::TokenEndpoint
- Defined in:
- lib/oidc_provider/token_endpoint.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
-
#initialize ⇒ TokenEndpoint
constructor
A new instance of TokenEndpoint.
Constructor Details
#initialize ⇒ TokenEndpoint
Returns a new instance of TokenEndpoint.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/oidc_provider/token_endpoint.rb', line 6 def initialize @app = Rack::OAuth2::Server::Token.new do |req, res| Rails.logger.info "Client ID: #{req.client_id}" Rails.logger.info "Client secret: #{req.client_secret}" Rails.logger.info "Redirect URI: #{req.redirect_uri}" client = ClientStore.new.find_by( identifier: req.client_id, secret: req.client_secret, redirect_uri: req.redirect_uri ) || req.invalid_client! Rails.logger.info "Found a client!" case req.grant_type when :authorization_code Rails.logger.info "Grant type was an authorization code. Correct!" = Authorization.valid.where(client_id: client.identifier, code: req.code).first || req.invalid_grant! Rails.logger.info "We found an authorization matching this code!" res.access_token = .access_token.to_bearer_token res.id_token = .id_token.to_jwt if .scopes.include?("openid") else Rails.logger.info "Unsupported grant type" req.unsupported_grant_type! end end end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
3 4 5 |
# File 'lib/oidc_provider/token_endpoint.rb', line 3 def app @app end |