token

package module
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 13 Imported by: 0

README

token

Build Status Maintainability Test Coverage

checks on DB and json file for credentials, if found returns a pseudo UDDI token.

Documentation

Overview

Package token generates pseudo uddi tokens if credentials used match any storage.

Index

Examples

Constants

View Source
const QueryCredentials = "SELECT IF(COUNT(*),'true','false') FROM app.credentials WHERE username = ? AND password = ?"

QueryCredentials is a query that executed on DB returns true if both user and password are found in a record.

Variables

View Source
var CredentialsJSONFile = "credentialsdb.json"

CredentialsJSONFile is the json file containing credentials.

Functions

func CheckCredentialsDBCtx added in v1.2.0

func CheckCredentialsDBCtx(ctx context.Context, c *Credentials) (bool, error)

CheckCredentialsDBCtx looks for credentials in the DB.

func CheckLocalCredentials

func CheckLocalCredentials(ctx context.Context, c *Credentials) (bool, error)

CheckLocalCredentials verifies username and passwords on local json file.

func GenerateCtx added in v1.2.0

func GenerateCtx(ctx context.Context) (string, error)

GenerateCtx generates a token.

Types

type Credentials

type Credentials struct {
	User     string
	Hashpass string
}

Credentials is the type used to pass username and password around.

func (*Credentials) Autenticato added in v1.3.0

func (c *Credentials) Autenticato(ctx context.Context) bool

Autenticato returns true if credentials are found in any storage.

Example
var c = Credentials{User: "pippo", Hashpass: "f583ca884c1d93458fb61ed137ff44f6"}

r := c.Autenticato(context.TODO())

fmt.Println(r)
Output:

true

func (Credentials) GetToken added in v1.3.0

func (c Credentials) GetToken(ctx context.Context) string

GetToken ...

type CtxINTERFACE added in v1.3.1

type CtxINTERFACE string

CtxINTERFACE allows to inform all go routines.

Jump to

Keyboard shortcuts

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