credentials

package
v0.0.15-r19 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials interface {
	// Check if given authorization data are mapped
	// to existent Credentials
	Authorize(...string) bool
	// Return Credentials type
	Type() string

	// Find Credentials in database by authorisation data and Unmarshall it's data into struct
	Find(context.Context, driver.Database) bool
	// Find Credentials in database by document key and Unmarshall it's data into struct
	FindByKey(context.Context, driver.Collection, string) error

	// Set Logger for Credentials methods
	SetLogger(*zap.Logger)
}

func Determine

func Determine(auth_type string) (cred Credentials, ok bool)

func Find

func Find(ctx context.Context, db driver.Database, log *zap.Logger, auth_type string, args ...string) (cred Credentials, err error)

func MakeCredentials

func MakeCredentials(credentials *accountspb.Credentials, log *zap.Logger) (Credentials, error)

func NewStandardCredentials

func NewStandardCredentials(username, password string) (Credentials, error)

func NewWHMCSCredentials

func NewWHMCSCredentials(email string) (Credentials, error)
type Link struct {
	From driver.DocumentID `json:"_from"`
	To   driver.DocumentID `json:"_to"`
	Type string            `json:"type"`
	Role string            `json:"role"`

	driver.DocumentMeta
}

type StandardCredentials

type StandardCredentials struct {
	Username     string `json:"username"`
	PasswordHash string `json:"password_hash"`

	driver.DocumentMeta
	// contains filtered or unexported fields
}

func (*StandardCredentials) Authorize

func (c *StandardCredentials) Authorize(args ...string) bool

Authorize method for StandardCredentials assumes that args consist of username and password stored at 0 and 1 accordingly

func (*StandardCredentials) Find

func (cred *StandardCredentials) Find(ctx context.Context, db driver.Database) bool

func (*StandardCredentials) FindByKey

func (cred *StandardCredentials) FindByKey(ctx context.Context, col driver.Collection, key string) error

func (*StandardCredentials) SetLogger

func (c *StandardCredentials) SetLogger(log *zap.Logger)

func (*StandardCredentials) Type

func (*StandardCredentials) Type() string

type WHMCSCredentials

type WHMCSCredentials struct {
	Email string `json:"email"`

	driver.DocumentMeta
	// contains filtered or unexported fields
}

func (*WHMCSCredentials) Authorize

func (c *WHMCSCredentials) Authorize(args ...string) bool

func (*WHMCSCredentials) Find

func (cred *WHMCSCredentials) Find(ctx context.Context, db driver.Database) bool

func (*WHMCSCredentials) FindByKey

func (cred *WHMCSCredentials) FindByKey(ctx context.Context, col driver.Collection, key string) error

func (*WHMCSCredentials) SetLogger

func (c *WHMCSCredentials) SetLogger(log *zap.Logger)

func (*WHMCSCredentials) Type

func (*WHMCSCredentials) Type() string

Jump to

Keyboard shortcuts

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