corbado

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

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 6 Imported by: 0

README

Go Geference Build Status

Description

This Go webhooks library can be used in your backend to handle webhook calls from Corbado.

The library handles webhooks authentication and takes care of the correct formatting of requests and responses. This allows you to focus on the actual implementation of the different actions.

Installation

For installation, use go get:

go get -u github.com/corbado/webhook-go

Documentation

To learn how Corbado uses webhooks, please have a look at our webhooks documentation.

Examples

See examples for a very simple usage of the webhooks library. We provide a standard HTTP library example and a Gin Web Framework example.

Development

This project uses a Makefile where all tasks are configured. make help will print out all commands and their function. Some tasks will not work on windows!

Linting
  • Use make lint-install to install golangcli
  • Use make lint to run the linter
Testing
  • Use make unittest to run all unittests

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns new builder instance.

func (*Builder) Build

func (b *Builder) Build() (Webhook, error)

Build builds a webhook instance, first validating all given parameters.

func (*Builder) SetAuthMethodsCallback

func (b *Builder) SetAuthMethodsCallback(authMethodsCallback callback.AuthMethods) *Builder

SetAuthMethodsCallback sets given callback on builder.

func (*Builder) SetLogger

func (b *Builder) SetLogger(logger logger.Logger) *Builder

SetLogger sets given logger

func (*Builder) SetPassword

func (b *Builder) SetPassword(password string) *Builder

SetPassword sets given password on builder.

func (*Builder) SetPasswordVerifyCallback

func (b *Builder) SetPasswordVerifyCallback(passwordVerifyCallback callback.PasswordVerify) *Builder

SetPasswordVerifyCallback sets given callback on builder.

func (*Builder) SetUsername

func (b *Builder) SetUsername(username string) *Builder

SetUsername sets given username on builder.

type Impl

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

func New

func New(
	logger logger.Logger,
	username string,
	password string,
	authMethodsCallback callback.AuthMethods,
	passwordVerifyCallback callback.PasswordVerify,
) (*Impl, error)

New returns new webhook instance.

func (*Impl) GetGinHandler

func (i *Impl) GetGinHandler() (*ginhandler.GinHandler, error)

GetGinHandler returns Gin handler which can be used in Gin Web Framework.

func (*Impl) GetStandardHandler

func (i *Impl) GetStandardHandler() (*standardhandler.StandardHandler, error)

GetStandardHandler returns standard handler which can be used in standard HTTP library.

type Webhook

type Webhook interface {
	GetStandardHandler() (*standardhandler.StandardHandler, error)
	GetGinHandler() (*ginhandler.GinHandler, error)
}

Jump to

Keyboard shortcuts

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