token

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Copyright 2017 Tink AB

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.

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.

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.

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.

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.

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

View Source
var RealTime realTime

Functions

This section is empty.

Types

type Cookie struct {
	Version string
	Token   []byte
}

type Crypto

type Crypto interface {
	Encrypt(b []byte) []byte
	Decrypt(sne []byte) ([]byte, error)
}

type EcdsaSigner

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

func NewEcdsaSigner

func NewEcdsaSigner(asn1 []byte) *EcdsaSigner

func (*EcdsaSigner) Public

func (s *EcdsaSigner) Public() []byte

func (*EcdsaSigner) Sign

func (s *EcdsaSigner) Sign(d []byte) []byte

type EcdsaVerifier

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

func NewEcdsaVerifier

func NewEcdsaVerifier(pkix []byte) *EcdsaVerifier

func (*EcdsaVerifier) Verify

func (v *EcdsaVerifier) Verify(d []byte, s []byte) bool

type Minter

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

func NewMinter

func NewMinter(ttl time.Duration, c Crypto, s Signer, p Provider, t Time) *Minter

func (*Minter) Create

func (m *Minter) Create(s Session) ([]byte, error)

type ProtectedCookie

type ProtectedCookie struct {
	Cookie []byte
	Sig    []byte
}

type Provider

type Provider interface {
	New(req Request) ([]byte, error)

	Validate(token []byte, domain string, group string) (*Request, error)
}

type Request

type Request struct {
	Domain string
	User   string
	Groups []string
	Expiry time.Time
}

type Session

type Session interface {
	Domain() string
	User() string
	Groups() []string
}

type Signer

type Signer interface {
	Sign(d []byte) []byte
}

type SimpleProvider

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

func NewSimpleProvider

func NewSimpleProvider(generation int, time Time) *SimpleProvider

func (*SimpleProvider) New

func (p *SimpleProvider) New(req Request) ([]byte, error)

func (*SimpleProvider) Validate

func (p *SimpleProvider) Validate(token []byte, domain string, group string) (*Request, error)

type SimpleToken

type SimpleToken struct {
	Request    Request
	Generation int
}

type StdCrypto

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

func NewStdCrypto

func NewStdCrypto(aes []byte) *StdCrypto

func (*StdCrypto) Decrypt

func (c *StdCrypto) Decrypt(ne []byte) ([]byte, error)

func (*StdCrypto) Encrypt

func (c *StdCrypto) Encrypt(b []byte) []byte

type Time

type Time interface {
	Now() time.Time
}

type Validator

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

func NewValidator

func NewValidator(c Crypto, ve Verifier, p Provider, t Time) *Validator

func (*Validator) Validate

func (v *Validator) Validate(d []byte, domain string, group string) (*Request, error)

type Verifier

type Verifier interface {
	Verify(d []byte, s []byte) bool
}

Jump to

Keyboard shortcuts

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