aadrm

package
v0.0.0-...-b0256a7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBaseURL *url.URL

Client uses DefaultBaseURL if not specified

Functions

func NewCertPool

func NewCertPool() *x509.CertPool

NewCertPool creates a *x509.CertPool which contains "Microsoft Root Certificate Authority 2011" (used by api.aadrm.com)

Types

type Client

type Client struct {

	// BaseURL is DefaultBaseURL if unspecified
	BaseURL *url.URL
	// Becomes the X-MS-RMS-Platform-Id header if set
	RMSPlatformID string
	// Becomes User-Agent header if set
	UserAgent string
	// contains filtered or unexported fields
}

Client interacts with aadrm

func NewClient

func NewClient(c *http.Client) *Client

NewClient creates a client, the caller must supply a client with auth (ex: via oauth2.TokenSource)

func (*Client) GetEndUserLicense

func (c *Client) GetEndUserLicense(ctx context.Context, license []byte) (*EndUserLicense, []byte, *http.Response, error)

GetEndUserLicense calls /my/v2/enduserlicenses

func (*Client) ListTemplates

func (c *Client) ListTemplates(ctx context.Context) ([]Template, *http.Response, error)

ListTemplates calls /my/v2/templates

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method string, path string, body io.Reader) (*http.Request, error)

NewRequest creates a request with the expected aadrm headers

type EndUserLicense

type EndUserLicense struct {
	ID                       *string                    `json:"Id,omitempty"`
	Name                     *string                    `json:"Name,omitempty"`
	Description              *string                    `json:"Description,omitempty"`
	Referrer                 *string                    `json:"Referrer,omitempty"`
	Owner                    *string                    `json:"Owner,omitempty"`
	AccessStatus             *string                    `json:"AccessStatus,omitempty"`
	Key                      *Key                       `json:"Key,omitempty"`
	Rights                   []string                   `json:"Rights,omitempty"`
	Roles                    []string                   `json:"Roles,omitempty"`
	IssuedTo                 *string                    `json:"IssuedTo,omitempty"`
	ContentValidUntil        *string                    `json:"ContentValidUntil,omitempty"`
	LicenseValidUntil        *string                    `json:"LicenseValidUntil,omitempty"`
	ContentID                *string                    `json:"ContentId,omitempty"`
	DocumentID               *string                    `json:"DocumentId,omitempty"`
	LabelID                  *string                    `json:"LabelId,omitempty"`
	OnlineAccessOnly         *bool                      `json:"OnlineAccessOnly,omitempty"`
	SignedApplicationData    map[string]json.RawMessage `json:"SignedApplicationData,omitempty"`
	EncryptedApplicationData map[string]json.RawMessage `json:"EncryptedApplicationData,omitempty"`
	FromTemplate             *bool                      `json:"FromTemplate,omitempty"`
	Policy                   *Policy                    `json:"Policy,omitempty"`
	ErrorMessage             *string                    `json:"ErrorMessage,omitempty"`
}

func DecodeEndUserLicense

func DecodeEndUserLicense(r io.Reader) (*EndUserLicense, error)

DecodeEndUserLicense decodes a *EndUserLicense from a io.Reader

func (*EndUserLicense) String

func (l *EndUserLicense) String() string

type Key

type Key struct {
	Value      *string `json:"Value,omitempty"`
	CipherMode *string `json:"CipherMode,omitempty"`
	Algorithm  *string `json:"Algorithm,omitempty"`
	Size       *int    `json:"Size,omitempty"`
}

func (*Key) Decrypt

func (k *Key) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt data using this key

type Policy

type Policy struct {
	AllowAuditedExtraction *bool       `json:"AllowAuditedExtraction,omitempty"`
	UserRoles              []string    `json:"UserRoles,omitempty"`
	UserRights             []UserRight `json:"UserRights,omitempty"`
	IntervalTimeInDays     *int        `json:"IntervalTimeInDays,omitempty"`
	LicenseValidUntil      *string     `json:"LicenseValidUntil,omitempty"`
}

type Template

type Template struct {
	ID          *string `json:"Id,omitempty"`
	Name        *string `json:"Name,omitempty"`
	Description *string `json:"Description,omitempty"`
}

type UserRight

type UserRight struct {
	Users  []string `json:"Users,omitempty"`
	Rights []string `json:"Rights,omitempty"`
}

Jump to

Keyboard shortcuts

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