Documentation ¶
Index ¶
- type ManageClients
- func (cl *ManageClients) AddDevice(deviceID string, displayName string, pubKey string) (string, error)
- func (cl *ManageClients) AddService(serviceID string, displayName string, pubKey string) (string, error)
- func (cl *ManageClients) AddUser(userID string, displayName string, password string, pubKey string, role string) (string, error)
- func (cl *ManageClients) GetCount() (n int, err error)
- func (cl *ManageClients) GetProfile(clientID string) (profile authapi.ClientProfile, err error)
- func (cl *ManageClients) GetProfiles() (profiles []authapi.ClientProfile, err error)
- func (cl *ManageClients) RemoveClient(clientID string) error
- func (cl *ManageClients) UpdateClient(clientID string, prof authapi.ClientProfile) error
- func (cl *ManageClients) UpdateClientPassword(clientID string, newPass string) error
- func (cl *ManageClients) UpdateClientRole(clientID string, newRole string) error
- type ProfileClient
- func (cl *ProfileClient) GetProfile() (profile authapi.ClientProfile, err error)
- func (cl *ProfileClient) NewToken(password string) (authToken string, err error)
- func (cl *ProfileClient) RefreshToken() (authToken string, err error)
- func (cl *ProfileClient) SetServicePermissions(capID string, roles []string) error
- func (cl *ProfileClient) UpdateName(newName string) error
- func (cl *ProfileClient) UpdatePassword(newPassword string) error
- func (cl *ProfileClient) UpdatePubKey(newPubKey string) error
- type RolesClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManageClients ¶
type ManageClients struct {
// contains filtered or unexported fields
}
ManageClients is a message (de)serializer for managing clients. This uses the default serializer 'ser' to marshal and unmarshal messages.
func NewManageClients ¶
func NewManageClients(hc *hubclient.HubClient) *ManageClients
NewManageClients returns an authn client management client
hc is the hub client connection to use
func (*ManageClients) AddDevice ¶
func (cl *ManageClients) AddDevice( deviceID string, displayName string, pubKey string) (string, error)
AddDevice adds an IoT device and generates an authentication token
func (*ManageClients) AddService ¶
func (cl *ManageClients) AddService( serviceID string, displayName string, pubKey string) (string, error)
AddService adds a service.
func (*ManageClients) AddUser ¶
func (cl *ManageClients) AddUser( userID string, displayName string, password string, pubKey string, role string) (string, error)
AddUser adds a user. The caller must be an administrator or service. If the userID already exists then an error is returned
userID is the login ID of the user, typically their email name of the user for presentation password the user can login with if their token has expired. pubKey is the user's public key string, needed to connect with JWT
func (*ManageClients) GetCount ¶
func (cl *ManageClients) GetCount() (n int, err error)
GetCount returns the number of clients in the store
func (*ManageClients) GetProfile ¶
func (cl *ManageClients) GetProfile(clientID string) (profile authapi.ClientProfile, err error)
GetProfile returns a client's profile Users can only get their own profile. Managers can get other clients profiles.
func (*ManageClients) GetProfiles ¶
func (cl *ManageClients) GetProfiles() (profiles []authapi.ClientProfile, err error)
GetProfiles provide a list of known clients and their info. The caller must be an administrator or service.
func (*ManageClients) RemoveClient ¶
func (cl *ManageClients) RemoveClient(clientID string) error
RemoveClient removes a client and disables authentication Existing tokens are immediately expired (tbd)
func (*ManageClients) UpdateClient ¶
func (cl *ManageClients) UpdateClient(clientID string, prof authapi.ClientProfile) error
UpdateClient updates a client's profile
func (*ManageClients) UpdateClientPassword ¶
func (cl *ManageClients) UpdateClientPassword(clientID string, newPass string) error
UpdateClientPassword updates a client's password
func (*ManageClients) UpdateClientRole ¶
func (cl *ManageClients) UpdateClientRole(clientID string, newRole string) error
UpdateClientRole updates a client's role
type ProfileClient ¶
type ProfileClient struct {
// contains filtered or unexported fields
}
ProfileClient is a marshaller for auth messages using a provided hub connection. This is intended for clients to authenticate themselves and refresh auth tokens. This uses the default serializer to marshal and unmarshal messages.
func NewProfileClient ¶
func NewProfileClient(hc *hubclient.HubClient) *ProfileClient
NewProfileClient returns an auth client for managing a user's profile
hc is the hub client connection to use
func (*ProfileClient) GetProfile ¶
func (cl *ProfileClient) GetProfile() (profile authapi.ClientProfile, err error)
GetProfile returns a client's profile Users can only get their own profile. Managers can get other clients profiles.
func (*ProfileClient) NewToken ¶
func (cl *ProfileClient) NewToken(password string) (authToken string, err error)
NewToken obtains an auth token based on loginID and password The user must have a public key set (using updatePubKey)
func (*ProfileClient) RefreshToken ¶
func (cl *ProfileClient) RefreshToken() (authToken string, err error)
RefreshToken a short-lived authentication token.
func (*ProfileClient) SetServicePermissions ¶
func (cl *ProfileClient) SetServicePermissions(capID string, roles []string) error
SetServicePermissions for use by services. Set the roles allowed to use the service. This is only for use by clients that are services.
func (*ProfileClient) UpdateName ¶
func (cl *ProfileClient) UpdateName(newName string) error
UpdateName updates a client's display name
func (*ProfileClient) UpdatePassword ¶
func (cl *ProfileClient) UpdatePassword(newPassword string) error
UpdatePassword changes the user password Login or Refresh must be called successfully first.
func (*ProfileClient) UpdatePubKey ¶
func (cl *ProfileClient) UpdatePubKey(newPubKey string) error
UpdatePubKey updates the user's public key and close the connection. This takes effect immediately. The client must reconnect to continue.
type RolesClient ¶
type RolesClient struct {
// contains filtered or unexported fields
}
RolesClient is a marshaller for messaging to manage custom roles This uses the default serializer to marshal and unmarshal messages.
func NewRolesClient ¶
func NewRolesClient(hc *hubclient.HubClient) *RolesClient
NewRolesClient creates a new client for managing roles
hc is the hub client connection to use
func (*RolesClient) CreateRole ¶
func (cl *RolesClient) CreateRole(role string) error
CreateRole creates a new custom role
func (*RolesClient) DeleteRole ¶
func (cl *RolesClient) DeleteRole(role string) error
DeleteRole deletes a custom role