auth

package
v0.0.0-...-c42f008 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type Authentication

type Authentication struct {
	LocalAuth *LocalAuthenticator

	SessionMaxAge time.Duration
	// contains filtered or unexported fields
}

func GetAuthInstance

func GetAuthInstance() *Authentication

func (*Authentication) Auth

func (auth *Authentication) Auth(
	onsuccess http.Handler,
	onfailure func(rw http.ResponseWriter, r *http.Request, authErr error),
) http.Handler

func (*Authentication) AuthViaSession

func (auth *Authentication) AuthViaSession(
	rw http.ResponseWriter,
	r *http.Request,
) (*repository.AppUser, error)

func (*Authentication) Login

func (auth *Authentication) Login(
	onfailure func(rw http.ResponseWriter, r *http.Request, loginErr error),
) http.Handler

func (*Authentication) Logout

func (auth *Authentication) Logout(onsuccess http.Handler) http.Handler

func (*Authentication) SaveSession

func (auth *Authentication) SaveSession(rw http.ResponseWriter,
	r *http.Request, user *repository.AppUser,
) error

type Authenticator

type Authenticator interface {
	CanLogin(user *repository.AppUser, username string, rw http.ResponseWriter, r *http.Request) (*repository.AppUser, bool)
	Login(user *repository.AppUser, rw http.ResponseWriter, r *http.Request) (*repository.AppUser, error)
}

type LocalAuthenticator

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

func (*LocalAuthenticator) CanLogin

func (la *LocalAuthenticator) CanLogin(
	user *repository.AppUser,
	username string,
	rw http.ResponseWriter,
	r *http.Request,
) (*repository.AppUser, bool)

func (*LocalAuthenticator) Init

func (la *LocalAuthenticator) Init() error

func (*LocalAuthenticator) Login

Jump to

Keyboard shortcuts

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