logical: add credential info to logical backend structures

This commit is contained in:
Mitchell Hashimoto
2015-03-30 14:23:32 -07:00
parent 5a4eb13750
commit c67357342c
4 changed files with 39 additions and 0 deletions

14
logical/auth.go Normal file
View File

@@ -0,0 +1,14 @@
package logical
// Auth is the resulting authentication information that is part of
// Response for credential backends.
type Auth struct {
// Policies is the list of policies that the authenticated user
// is associated with.
Policies []string
// Metadata is used to attach arbitrary string-type metadata to
// an authenticated user. This metadata will be outputted into the
// audit log.
Metadata map[string]string
}

15
logical/connection.go Normal file
View File

@@ -0,0 +1,15 @@
package logical
import (
"crypto/tls"
)
// Connection represents the connection information for a request. This
// is present on the Request structure for credential backends.
type Connection struct {
// RemoteAddr is the network address that sent the request.
RemoteAddr string
// ConnState is the TLS connection state if applicable.
ConnState *tls.ConnectionState
}

View File

@@ -27,6 +27,11 @@ type Request struct {
// to represent the secret that was returned prior.
Secret *Secret
// Connection will be non-nil only for credential providers to
// inspect the connection information and potentially use it for
// authentication/protection.
Connection *Connection
// ClientToken is provided to the core so that the identity
// can be verified and ACLs applied. This value is not passed
// through to the logical backends.

View File

@@ -6,6 +6,11 @@ type Response struct {
// Secret, if not nil, denotes that this response represents a secret.
Secret *Secret
// Auth, if not nil, contains the authentication information for
// this response. This is only checked and means something for
// credential backends.
Auth *Auth
// Response data is an opaque map that must have string keys. For
// secrets, this data is sent down to the user as-is. To store internal
// data that you don't want the user to see, store it in