auth

Paddy 2015-06-29 Parent:b0d1b3e39fc8 Child:4b68bac597b7

175:aa14e29b666f Go to Latest

auth/client/login.go

Create Docker image for authd. Create a Dockerfile for authd, which will wrap the compiled Go binary up into a tiny little Docker image. Create an authd/build-docker.sh script that will build the statically-linked binary in a Docker container, so the authd Docker image can use it. We had to include ca-certificates.crt in the Dockerfile, as well, so we could communicate over SSL with things. A wrapper.sh file is included that will pull the JWT_SECRET environment variable out of a kubernetes secrets file, which is a handy wrapper to have. Finally, we added the authd/docker-authd binary to the .hgignore.

History
paddy@172 1 package client
paddy@172 2
paddy@172 3 import (
paddy@172 4 "code.secondbit.org/auth.hg"
paddy@172 5 )
paddy@172 6
paddy@172 7 func (c *Client) GetLogin(value string) (auth.Login, error) {
paddy@173 8 resp, err := c.Get("/logins/"+value, auth.Scopes{auth.ScopeLoginAdmin}.Strings(), nil)
paddy@172 9 if err != nil {
paddy@172 10 return auth.Login{}, err
paddy@172 11 }
paddy@172 12 if len(resp.Logins) < 1 {
paddy@172 13 return auth.Login{}, auth.ErrLoginNotFound
paddy@172 14 }
paddy@172 15 return resp.Logins[0], nil
paddy@172 16 }