passport

package module
v0.0.12 Latest Latest
Warning

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

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

README

start

docker compose -f "docker-compose.yaml" up -d --build go run cmd/main.go

integrate

use the public code to start up the service as part of your api use docker image

passport

GoDoc Build GoReport Coverage Status

Package passport is an identity access management api.

go get github.com/georgi-georgiev/passport

database

create mongodb database passport

docker

pull docker pull bracer/passport run docker run bracer/passport

Contributing

If you'd like to contribute to passport, we'd love your input! Please submit an issue first so we can discuss your proposal.


Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleHealthCheck

func HandleHealthCheck(w http.ResponseWriter, r *http.Request)

func HandleHealthCheckWithCallback

func HandleHealthCheckWithCallback(healthCallback func() string) func(w http.ResponseWriter, r *http.Request)

healthcheck handler with custom callback for printing service specific additional info

func HandleRuntimeStats

func HandleRuntimeStats(w http.ResponseWriter, r *http.Request)

func Hash

func Hash(password string) (string, error)

Hash salts password and hashes it, returning salted hash

func Match

func Match(password, hash string) bool

Match compares password with salted hashed value

func NewGinEngine

func NewGinEngine(conf *Config, logger *zap.Logger, blunder *blunder.Blunder, sentryClient *sentry.Client) *gin.Engine

func NewHTTPServer

func NewHTTPServer(lc fx.Lifecycle, conf *Config, log *zap.Logger, app *gin.Engine) *http.Server

func NewLogger

func NewLogger() *zap.Logger

func NewMongoClient

func NewMongoClient(conf *Config) *mongo.Client

func NewSentry

func NewSentry(conf *Config) *sentry.Client

func ReusableReader

func ReusableReader(r io.Reader) io.Reader

Types

type AppConfiguration

type AppConfiguration struct {
	Name        string
	Version     string
	PrivKeyPath string
	PubKeyPath  string
}

type Config

func NewConfig

func NewConfig() *Config

type MailClient

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

func NewMailCleint

func NewMailCleint(conf *Config, log *zap.Logger) *MailClient

func (*MailClient) Send

func (mc *MailClient) Send(ctx context.Context, subject string, body string, email string) error

type MailConfiguration

type MailConfiguration struct {
	ApiKey      string
	PartnerKey  string
	SenderEmail string
}

type MongoConfiguration

type MongoConfiguration struct {
	Url      string
	Dbname   string
	Username string
	Password string
}

type MongoRepository

type MongoRepository struct {
	Client     *mongo.Client
	Database   *mongo.Database
	Collection *mongo.Collection
}

func NewMongoRepository

func NewMongoRepository(client *mongo.Client, dbname string, collectionName string) *MongoRepository

func (*MongoRepository) Create

func (r *MongoRepository) Create(ctx context.Context, v interface{}) (primitive.ObjectID, error)

func (*MongoRepository) DeleteById

func (r *MongoRepository) DeleteById(ctx context.Context, id primitive.ObjectID) (bool, error)

func (*MongoRepository) GetById

func (r *MongoRepository) GetById(ctx context.Context, id primitive.ObjectID, v interface{}) (bool, error)

func (*MongoRepository) GetStringFieldForId

func (r *MongoRepository) GetStringFieldForId(ctx context.Context, id primitive.ObjectID, field string) (string, error)

func (*MongoRepository) SetFieldAndWipeOtherForId

func (r *MongoRepository) SetFieldAndWipeOtherForId(ctx context.Context, id primitive.ObjectID, fieldToSet string, value string, fieldToWipe string) error

func (*MongoRepository) UpdateById

func (r *MongoRepository) UpdateById(ctx context.Context, id primitive.ObjectID, updateBody bson.M) error

type SentryConfiguration

type SentryConfiguration struct {
	DNS string
}

type ServerConfiguration

type ServerConfiguration struct {
	RootURL         string
	Host            string
	Port            string
	ShutdownTimeout int
	Timeout         struct {
		Server time.Duration
		Read   time.Duration
		Write  time.Duration
		Idle   time.Duration
	}
}

type SwaggerConfiguration

type SwaggerConfiguration struct {
	Host string
}

type UserClaims

type UserClaims struct {
	jwt.StandardClaims
	Role       string   `json:"role"`
	RoleId     string   `json:"roleId"`
	Rights     []string `json:"rights"`
	IsAdmin    bool     `json:"isAdmin"`
	IsVerified bool     `json:"isVerified"`
}

func (UserClaims) Valid added in v0.0.11

func (c UserClaims) Valid() error

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
pkg

Jump to

Keyboard shortcuts

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