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