credentials

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright © 2021-2023 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-2023 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-2023 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

func SetupSettingsClient

func SetupSettingsClient(logger *zap.Logger, settingsClient pb.SettingsServiceClient, internal_token string)

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 NewOAuth2Credentials added in v0.0.18

func NewOAuth2Credentials(data []string, credType string) (Credentials, error)

func NewStandardCredentials

func NewStandardCredentials(data []string) (Credentials, error)

func NewWHMCSCredentials

func NewWHMCSCredentials(data []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 OAuth2Credentials added in v0.0.18

type OAuth2Credentials struct {
	AuthField string `json:"auth_field"`
	AuthValue string `json:"auth_value"`

	AuthType string `json:"auth_type"`

	driver.DocumentMeta
	// contains filtered or unexported fields
}

func (*OAuth2Credentials) Authorize added in v0.0.18

func (cred *OAuth2Credentials) Authorize(args ...string) bool

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

func (*OAuth2Credentials) Find added in v0.0.18

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

func (*OAuth2Credentials) FindByKey added in v0.0.18

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

func (*OAuth2Credentials) SetLogger added in v0.0.18

func (cred *OAuth2Credentials) SetLogger(log *zap.Logger)

func (*OAuth2Credentials) Type added in v0.0.18

func (cred *OAuth2Credentials) Type() string

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 WHMCSConfig

type WHMCSConfig struct {
	Api        string `json:"api"`
	User       string `json:"user"`
	Pass       string `json:"pass_hash"`
	DangerMode bool   `json:"danger_mode"`
}

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