Sha256: 424ebf58a13b1842a80816abac5fbf13e8f1af0518d86a28487903564997dc3e
Contents?: true
Size: 783 Bytes
Versions: 2
Compression:
Stored size: 783 Bytes
Contents
require_dependency 'linkedin_sign_in/redirect_protector' class LinkedinSignIn::CallbacksController < LinkedinSignIn::BaseController def show if valid_request? redirect_to proceed_to_url, flash: { linkedin_sign_in_token: token } else head :unprocessable_entity end rescue LinkedinSignIn::RedirectProtector::Violation => error logger.error error.message head :bad_request end private def valid_request? flash[:state].present? && params.require(:state) == flash[:state] && params[:error].blank? end def proceed_to_url flash[:proceed_to].tap { |url| LinkedinSignIn::RedirectProtector.ensure_same_origin(url, request.url) } end def token client.auth_code.get_token(params.require(:code)).token end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
linkedin_sign_in-0.3.1 | app/controllers/linkedin_sign_in/callbacks_controller.rb |
linkedin_sign_in-0.3 | app/controllers/linkedin_sign_in/callbacks_controller.rb |