module Pachyderm

Public Class Methods

LoggedIn?(token) click to toggle source
# File lib/pachyderm.rb, line 5
def LoggedIn?(token)
        raise Exception.new("user token required") if token.nil?
        client = Auth::API::Stub.new($address, :this_channel_is_insecure)
        begin
                res = client.whoami(Auth::WhoAmIRequest.new, metadata(token))
                puts "logged in as #{res.username}, admin? #{res.is_admin}\n"
        rescue GRPC::Unauthenticated 
                return false
        end
        return true
end