<commit_before>package auth

import (
	"github.com/google/uuid"
)

var (
	DefaultAuth = NewAuth()
)

func NewAuth(opts ...Option) Auth {
	return &noop{}
}

type noop struct {
	opts Options
}

// String returns the name of the implementation
func (n *noop) String() string {
	return "noop"
}

// Init the auth
func (n *noop) Init(opts ...Option) {
	for _, o := range opts {
		o(&n.opts)
	}
}

// Options set for auth
func (n *noop) Options() Options {
	return n.opts
}

// Generate a new account
func (n *noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
	options := NewGenerateOptions(opts...)

	return &Account{
		ID:       id,
		Roles:    options.Roles,
		Metadata: options.Metadata,
	}, nil
}

// Grant access to a resource
func (n *noop) Grant(role string, res *Resource) error {
	return nil
}

// Revoke access to a resource
func (n *noop) Revoke(role string, res *Resource) error {
	return nil
}

// Verify an account has access to a resource
func (n *noop) Verify(acc *Account, res *Resource) error {
	return nil
}

// Inspect a token
func (n *noop) Inspect(token string) (*Account, error) {
	return &Account{
		ID:     uuid.New().String(),
		Secret: &Token{},
	}, nil
}

// Refresh an account using a secret<commit_msg>Default auth, return account secret on Inspect (#1430)<commit_after>package auth

import (
	"github.com/google/uuid"
)

var (
	DefaultAuth = NewAuth()
)

func NewAuth(opts ...Option) Auth {
	return &noop{}
}

type noop struct {
	opts Options
}

// String returns the name of the implementation
func (n *noop) String() string {
	return "noop"
}

// Init the auth
func (n *noop) Init(opts ...Option) {
	for _, o := range opts {
		o(&n.opts)
	}
}

// Options set for auth
func (n *noop) Options() Options {
	return n.opts
}

// Generate a new account
func (n *noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
	options := NewGenerateOptions(opts...)

	return &Account{
		ID:       id,
		Roles:    options.Roles,
		Metadata: options.Metadata,
		Secret:   &Token{},
	}, nil
}

// Grant access to a resource
func (n *noop) Grant(role string, res *Resource) error {
	return nil
}

// Revoke access to a resource
func (n *noop) Revoke(role string, res *Resource) error {
	return nil
}

// Verify an account has access to a resource
func (n *noop) Verify(acc *Account, res *Resource) error {
	return nil
}

// Inspect a token
func (n *noop) Inspect(token string) (*Account, error) {
	return &Account{
		ID: uuid.New().String(),
	}, nil
}

// Refresh an account using a secret
{'fraction_non_alphanumeric': 0.1365969206474536, 'fraction_numerical': 0.0015791551519936833, 'mean_word_length': 3.3993055555555554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1822723', 'n_tokens_mistral': 884, 'n_tokens_neox': 850, 'n_words': 308}