35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/oauth/controllers/provider_controller.rb', line 35
def token
@client_application = ClientApplication.find_by_key! params[:client_id]
if @client_application.secret != params[:client_secret]
oauth2_error "invalid_client"
return
end
params[:grant_type] = 'client_credentials' if params[:grant_type] == 'none'
logger.info "grant_type=#{params[:grant_type]}"
if ["authorization_code", "password", "client_credentials"].include?(params[:grant_type])
send "oauth2_token_#{params[:grant_type].underscore}"
else
oauth2_error "unsupported_grant_type"
end
end
|