Documentation ¶
Index ¶
- Variables
- func Authenticate(req *http.Request) (string, error)
- func GetOrigin(req *http.Request) string
- func NewAuthenticateHeader(req *http.Request) string
- func NewRandomID() string
- func ValidateToken(auth *Authorization) error
- type Authentication
- type Authorization
- type NS
- type Signer
- type Token
- type Verifier
Constants ¶
This section is empty.
Variables ¶
var ( // token validity in minutes TokenDuration = 1 DurationScale = time.Minute )
Functions ¶
func Authenticate ¶
Authenticate authenticates a user using WebID-RSA
func NewAuthenticateHeader ¶
func NewRandomID ¶
func NewRandomID() string
func ValidateToken ¶
func ValidateToken(auth *Authorization) error
Types ¶
type Authentication ¶
type Authentication struct {
Source, Nonce, Username string
}
Authentication structure
func ParseAuthenticateHeader ¶
func ParseAuthenticateHeader(header string) (*Authentication, error)
ParseAuthenticateHeader parses an Authenticate header and returns an Authentication object
type Authorization ¶
type Authorization struct {
Type, Source, Username, Nonce, Signature string
}
Authorization structure
func ParseAuthorizationHeader ¶
func ParseAuthorizationHeader(header string) (*Authorization, error)
ParseAuthorizationHeader parses an Authorization header into a local Authorization structure
type Signer ¶
Signer creates signatures that verify against a public key.
func ParsePrivateKey ¶
func ParsePrivateKey(key *rsa.PrivateKey) (Signer, error)
ParsePrivateKey parses an RSA private key and returns a new signer object
func ParsePrivatePEMKey ¶
ParsePrivatePEMKey parses a PEM encoded private key and returns a Signer.
type Verifier ¶
Verifier verifies signatures against a public key.
func ParsePublicKey ¶
ParsePublicKey parses an RSA public key and returns a new verifier object
func ParsePublicKeyNE ¶
ParsePublicKeyNE parses a modulus and exponent and returns a new verifier object
func ParsePublicPEMKey ¶
ParsePublicPEMKey parses a PEM encoded private key and returns a new verifier object