Help us shape the future of Go! Take the 2026 Go Developer Survey

go_flarum

package module
v0.0.0-...-f25632f Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2017 License: MIT Imports: 6 Imported by: 4

README

flarum-go-sso

Singe Sign On package for Flarum SSO extension

Installation

Here go installation instructions

Contributions

Contributions instructions

Licence

MIT Licence, aka do (almost) whatever you want ∑

Documentation

Index

Constants

View Source
const COOKIE_REMEMBER_ME = "flarum_remember"
View Source
const COOKIE_SESSION = "flarum_session"
View Source
const DAYS_MULTIPLIER = 60 * 60 * 24
View Source
const FORUM_API_SUFFIX = "/api"

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	ERROR_GENERAL             string
	ERROR_INVALID_CREDENTIALS string
}

type FlarumClient

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

func NewClient

func NewClient(url string, token string, maxAge int) *FlarumClient
  • Creates a new client for the Flarum forum. Requires:
  • Forum URL: without /api suffix and without trailing slash. eg. http://myforum.example.com
  • Token: The API token that you set in your `_api_keys` table
  • maxAge: Number of days for the cookie to be valid

func (FlarumClient) ActivateUser

func (fc FlarumClient) ActivateUser(userId string) error

func (FlarumClient) DeactivateUser

func (fc FlarumClient) DeactivateUser(userId string) error

func (FlarumClient) DeleteUser

func (fc FlarumClient) DeleteUser(userId string) error

DeleteUser removes a user form the database. This is action cannot be undone!

func (FlarumClient) GetUserByUsername

func (fc FlarumClient) GetUserByUsername(username string) (user map[string]interface{}, err error)

GetUserByUsername fetches the user data by a given userId

func (FlarumClient) LogIn

func (fc FlarumClient) LogIn(username string, password string) (token string, userId string, err error)

LogIn creates a RememberMe token that can be added as a cookie to authenticate in Flarum forum

func (FlarumClient) SignUp

func (fc FlarumClient) SignUp(username string, email string, password string) error

SignUp creates a new account in Flarum with the provided username, email and password Password needs to be at least 8 characters long

func (FlarumClient) UpdateUserAttribute

func (fc FlarumClient) UpdateUserAttribute(userId string, attribute string, value string) error

UpdateUserBio update user field for a given attribute key and value

type RequestType

type RequestType struct {
	GET            string
	POST           string
	PATCH          string
	DELETE         string
	PROTOCOL_HTTP  string
	PROTOCOL_HTTPS string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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