Sha256: 97442673eccf2afa43f25c91b6365a4913ee434abfc12883a371da76c28b969a

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

module RestPack::User::Service::Commands::User
  class OmniAuthenticate < RestPack::Service::Command
    required do
      integer :application_id
      hash :omniauth_response do
        required do
          string :provider
          string :uid
          hash :info
        end
      end
    end

    optional do
      integer :user_id
    end

    def execute
      user = RestPack::User::Service::Models::User.authenticate(
        user_id,
        application_id,
        omniauth_response
      )

      if user
        return RestPack::User::Service::Serializers::UserSerializer.resource(user)
      else
        status :unauthorized
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_user_service-0.0.2 lib/restpack_user_service/commands/user/omni_authenticate.rb