apilsd

package
v0.0.0-...-99fd3eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2022 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LICENSE_STATUS        = "status"
	REGISTER_DEVICE       = "register"
	RENEW_LICENSE         = "renew"
	RETURN_LICENSE        = "return"
	CANCEL_REVOKE_LICENSE = "revoke"
)

Possible values of test stage

View Source
const Sha256_URL string = "http://www.w3.org/2001/04/xmlenc#sha256"

Variables

This section is empty.

Functions

func AddLogToFile

func AddLogToFile(w http.ResponseWriter, r *http.Request, s Server)

AddLogToFile adds a log message to the log file

func CreateLicenseStatusDocument

func CreateLicenseStatusDocument(w http.ResponseWriter, r *http.Request, s Server)

CreateLicenseStatusDocument creates a license status and adds it to database It is triggered by a notification from the license server

func FilterLicenseStatuses

func FilterLicenseStatuses(w http.ResponseWriter, r *http.Request, s Server)

FilterLicenseStatuses returns a sequence of license statuses, in their id order function for detecting licenses which used a lot of devices

func GetFreshLicense

func GetFreshLicense(w http.ResponseWriter, r *http.Request, s Server)

GetFreshLicense gets a fresh license from the License Server after requesting user data (for this license) from the CMS.

func GetLicenseStatusDocument

func GetLicenseStatusDocument(w http.ResponseWriter, r *http.Request, s Server)

GetLicenseStatusDocument gets a license status from the db by license id checks potential_rights_end and fill it

func LendingCancellation

func LendingCancellation(w http.ResponseWriter, r *http.Request, s Server)

LendingCancellation cancels (before use) or revokes (after use) a license. parameters:

key: license id
partial license status: the new status and a message indicating why the status is being changed
The new status can be either STATUS_CANCELLED or STATUS_REVOKED

func LendingRenewal

func LendingRenewal(w http.ResponseWriter, r *http.Request, s Server)

LendingRenewal checks that the calling device is registered with the license, then modifies the end date associated with the license and returns an updated license status to the caller. the 'end' parameter is optional; if absent, the end date is computed from the current end date plus a configuration parameter. Note: as per the spec, a non-registered device can renew a loan.

func LendingReturn

func LendingReturn(w http.ResponseWriter, r *http.Request, s Server)

LendingReturn checks that the calling device is activated, then modifies the end date associated with the given license & returns updated and filled license status

func ListRegisteredDevices

func ListRegisteredDevices(w http.ResponseWriter, r *http.Request, s Server)

ListRegisteredDevices returns data about the use of a given license

func RegisterDevice

func RegisterDevice(w http.ResponseWriter, r *http.Request, s Server)

RegisterDevice registers a device for a given license, using the device id & name as parameters; returns the updated license status

Types

type Server

type Server interface {
	Transactions() transactions.Transactions
	LicenseStatuses() licensestatuses.LicenseStatuses
	GoofyMode() bool
}

Server interface

type UserData

type UserData struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Email          string `json:"email"`
	PassphraseHash string `json:"passphrasehash"`
	Hint           string `json:"hint"`
}

UserData represents the payload requested to the CMS. This is a simplified version of a partial license, easy to generate for any CMS developer. PassphraseHash is the result of the hash calculation, as an hex-encoded string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL