Sha256: d8f675cafcdf899fccccaef89614a091bcbb2382e4c7379b47f59a96de955a08

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

module RestPack::User::Service::Commands
  module 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 = Models::User.authenticate(
          user_id,
          application_id,
          raw_inputs[:omniauth_response]
        )

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

Version data entries

1 entries across 1 versions & 1 rubygems

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