Documentation ¶
Overview ¶
Copyright 2018 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func IsErrDevAuthBadRequest(e error) bool
- func IsErrDevAuthUnauthorized(e error) bool
- func MakeErrDevAuthBadRequest(e error) error
- func MakeErrDevAuthUnauthorized(e error) error
- type ApiClientGetter
- type App
- type Config
- type DevAuth
- func (d *DevAuth) AcceptDeviceAuth(ctx context.Context, device_id string, auth_id string) error
- func (d *DevAuth) DecommissionDevice(ctx context.Context, devId string) error
- func (d *DevAuth) DeleteAuthSet(ctx context.Context, devId string, authId string) error
- func (d *DevAuth) DeleteTokens(ctx context.Context, tenant_id, device_id string) error
- func (d *DevAuth) GetDevCountByStatus(ctx context.Context, status string) (int, error)
- func (d *DevAuth) GetDevice(ctx context.Context, devId string) (*model.Device, error)
- func (*DevAuth) GetDeviceToken(ctx context.Context, dev_id string) (*model.Token, error)
- func (d *DevAuth) GetDevices(ctx context.Context, skip, limit uint, filter store.DeviceFilter) ([]model.Device, error)
- func (d *DevAuth) GetLimit(ctx context.Context, name string) (*model.Limit, error)
- func (d *DevAuth) GetTenantDeviceStatus(ctx context.Context, tenantId, deviceId string) (*model.Status, error)
- func (d *DevAuth) GetTenantLimit(ctx context.Context, name, tenant_id string) (*model.Limit, error)
- func (d *DevAuth) PreauthorizeDevice(ctx context.Context, req *model.PreAuthReq) error
- func (d *DevAuth) ProvisionTenant(ctx context.Context, tenant_id string) error
- func (d *DevAuth) RejectDeviceAuth(ctx context.Context, device_id string, auth_id string) error
- func (d *DevAuth) ResetDeviceAuth(ctx context.Context, device_id string, auth_id string) error
- func (d *DevAuth) RevokeToken(ctx context.Context, token_id string) error
- func (d *DevAuth) SetTenantLimit(ctx context.Context, tenant_id string, limit model.Limit) error
- func (d *DevAuth) SubmitAuthRequest(ctx context.Context, r *model.AuthReq) (string, error)
- func (d *DevAuth) VerifyToken(ctx context.Context, raw string) error
- func (d *DevAuth) WithTenantVerification(c tenant.ClientRunner) *DevAuth
Constants ¶
View Source
const ( MsgErrDevAuthBadRequest = "dev auth: bad request" )
Variables ¶
View Source
var ( ErrDevIdAuthIdMismatch = errors.New("dev auth: dev ID and auth ID mismatch") ErrMaxDeviceCountReached = errors.New("maximum number of accepted devices reached") ErrDeviceExists = errors.New("device already exists") ErrDeviceNotFound = errors.New("device not found") ErrDevAuthBadRequest = errors.New(MsgErrDevAuthBadRequest) )
Functions ¶
func IsErrDevAuthBadRequest ¶
Types ¶
type ApiClientGetter ¶
type ApiClientGetter func() apiclient.HttpRunner
helper for obtaining API clients
type App ¶
type App interface { SubmitAuthRequest(ctx context.Context, r *model.AuthReq) (string, error) GetDevices(ctx context.Context, skip, limit uint, filter store.DeviceFilter) ([]model.Device, error) GetDevice(ctx context.Context, dev_id string) (*model.Device, error) DecommissionDevice(ctx context.Context, dev_id string) error DeleteAuthSet(ctx context.Context, dev_id string, auth_id string) error AcceptDeviceAuth(ctx context.Context, dev_id string, auth_id string) error RejectDeviceAuth(ctx context.Context, dev_id string, auth_id string) error ResetDeviceAuth(ctx context.Context, dev_id string, auth_id string) error GetDeviceToken(ctx context.Context, dev_id string) (*model.Token, error) RevokeToken(ctx context.Context, token_id string) error VerifyToken(ctx context.Context, token string) error DeleteTokens(ctx context.Context, tenant_id, device_id string) error SetTenantLimit(ctx context.Context, tenant_id string, limit model.Limit) error GetLimit(ctx context.Context, name string) (*model.Limit, error) GetTenantLimit(ctx context.Context, name, tenant_id string) (*model.Limit, error) GetDevCountByStatus(ctx context.Context, status string) (int, error) ProvisionTenant(ctx context.Context, tenant_id string) error GetTenantDeviceStatus(ctx context.Context, tenantId, deviceId string) (*model.Status, error) }
this device auth service interface
type DevAuth ¶
type DevAuth struct {
// contains filtered or unexported fields
}
func NewDevAuth ¶
func NewDevAuth(d store.DataStore, co orchestrator.ClientRunner, jwt jwt.Handler, config Config) *DevAuth
func (*DevAuth) AcceptDeviceAuth ¶
func (*DevAuth) DecommissionDevice ¶
DecommissionDevice deletes device and all its tokens
func (*DevAuth) DeleteAuthSet ¶
Deletes device authentication set, and optionally the device.
func (*DevAuth) DeleteTokens ¶
func (*DevAuth) GetDevCountByStatus ¶
func (*DevAuth) GetDeviceToken ¶
func (*DevAuth) GetDevices ¶
func (*DevAuth) GetTenantDeviceStatus ¶
func (*DevAuth) GetTenantLimit ¶
func (*DevAuth) PreauthorizeDevice ¶
func (*DevAuth) ProvisionTenant ¶
func (*DevAuth) RejectDeviceAuth ¶
func (*DevAuth) ResetDeviceAuth ¶
func (*DevAuth) RevokeToken ¶
func (*DevAuth) SetTenantLimit ¶
func (*DevAuth) SubmitAuthRequest ¶
func (*DevAuth) WithTenantVerification ¶
func (d *DevAuth) WithTenantVerification(c tenant.ClientRunner) *DevAuth
WithTenantVerification will force verification of tenant token with tenant administrator when processing device authentication requests. Returns an updated devauth.
Click to show internal directories.
Click to hide internal directories.