Module: Pachyderm
- Defined in:
- lib/pachyderm.rb,
lib/client/pfs/pfs_pb.rb,
lib/client/pps/pps_pb.rb,
lib/client/auth/auth_pb.rb,
lib/client/admin/admin_pb.rb,
lib/client/deploy/deploy_pb.rb,
lib/client/health/health_pb.rb,
lib/client/pkg/shard/shard_pb.rb,
lib/client/pfs/pfs_services_pb.rb,
lib/client/pps/pps_services_pb.rb,
lib/client/auth/auth_services_pb.rb,
lib/client/admin/admin_services_pb.rb,
lib/client/enterprise/enterprise_pb.rb,
lib/client/deploy/deploy_services_pb.rb,
lib/client/health/health_services_pb.rb,
lib/client/version/versionpb/version_pb.rb,
lib/client/enterprise/enterprise_services_pb.rb,
lib/client/version/versionpb/version_services_pb.rb
Defined Under Namespace
Modules: Admin, Auth, Deploy, Enterprise, Health, Pfs, Pps, Shard, Versionpb
Class Method Summary
collapse
Class Method Details
.LoggedIn?(token) ⇒ Boolean
5
6
7
8
9
10
11
12
13
14
15
|
# 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
|
17
18
19
20
21
22
|
# File 'lib/pachyderm.rb', line 17
def metadata(token)
{:metadata => {'authn-token' => token}}
end
|