loginmodule

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package loginmodule provides functions related to user login.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(data []byte, clientKey string) string

Encode encodes the given bytes array using the given key for the login module (AES128ECB + BASE64).

func EncodeBody

func EncodeBody(requestParams map[string]string, clientID, clientKey string) (result []byte, err error)

EncodeBody forms a request body with the given parameters for the login module: `{"client_id": ..., "data": _encoded_}`.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client is the login module client.

func NewClient

func NewClient(loginModuleURL string) *Client

NewClient creates a new login module client.

func (*Client) CreateUsers

func (client *Client) CreateUsers(ctx context.Context, clientID, clientKey string,
	params *CreateUsersParams,
) (bool, []CreateUsersResponseDataRow, error)

CreateUsers creates a batch of users in the login module.

func (*Client) DeleteUsers

func (client *Client) DeleteUsers(ctx context.Context, clientID, clientKey, loginPrefix string) (bool, error)

DeleteUsers deletes users specified by the given login prefix from the login module.

func (*Client) GetUserProfile

func (client *Client) GetUserProfile(ctx context.Context, accessToken string) (profile map[string]interface{}, err error)

GetUserProfile returns a user profile for given access token.

func (*Client) SendLTIResult

func (client *Client) SendLTIResult(
	ctx context.Context, clientID, clientKey string, userLoginID, itemID int64, score float32,
) (bool, error)

SendLTIResult sends item score to LTI.

func (*Client) UnlinkClient

func (client *Client) UnlinkClient(ctx context.Context, clientID, clientKey string, userLoginID int64) (bool, error)

UnlinkClient discards our client authorization for the login module user.

type CreateUsersParams

type CreateUsersParams struct {
	Prefix         string
	Amount         int
	PostfixLength  int
	PasswordLength int
	LoginFixed     *bool
	Language       *string
}

CreateUsersParams represents parameters for Client.CreateUsers().

type CreateUsersResponseDataRow

type CreateUsersResponseDataRow struct {
	ID       int64  `json:"id"`
	Login    string `json:"login"`
	Password string `json:"password"`
}

CreateUsersResponseDataRow represents an element of the array returned by Client.CreateUsers() (id, login, password).

Jump to

Keyboard shortcuts

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