Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeHTTP(v url.Values, p map[string]string)
- func EncodeKeyValue(w io.Writer, p map[string]string) error
- func ParseHTTP(v url.Values) map[string]string
- func ParseKeyValue(body []byte) (map[string]string, error)
- func WriteKeyValuePair(w io.Writer, key, value string) error
- type Association
- type AssociationStore
- type Extension
- type Handler
- type LoginHandler
- type LoginRequest
- type LoginResponse
- type MemoryAssociationStore
Constants ¶
const Namespace = "http://specs.openid.net/auth/2.0"
Variables ¶
var ErrDuplicateAssociation = errors.New("duplicate association")
var ErrUnauthenticated = errors.New("authentication failed")
Functions ¶
func EncodeHTTP ¶
EncodeHTTP updates v with the encoding of p.
Types ¶
type Association ¶
type Association struct { // Endpoint is the OP Endpoint for which this association is valid. It might be blank. Endpoint string // Handle is used to identify the association with the OP Endpoint. Handle string // Secret is the secret established with the OP Endpoint. Secret []byte // Type is the type of this association. Type string // Expires holds the expiration time of the association. Expires time.Time }
Association represents an openid association.
type AssociationStore ¶
type AssociationStore interface { // Add stores a new Association. If the specified Association is already // present in the store then ErrDuplicateAssociation should be returned. Add(a *Association) error // Get retrieves the Association with the specified endpoint and handle. // if there is no matching association in the store then ErrAssociationNotFound // should be returned. Get(endpoint, handle string) (*Association, error) // Find retrieves all Associations for the specified endpoint. Find(endpoint string) ([]*Association, error) // Delete removes the Association with the specified endpoint and handle. Delete(endpoint, handle string) error }
AssociationStore is used to store associations in both the server and client.
var DefaultAssociationStore AssociationStore = NewMemoryAssociationStore()
DefaultAssociationStore is the AssociationStore that will be used if no AssociationStore is specified.
type Handler ¶
type Handler struct { Login LoginHandler Associations AssociationStore }
type LoginHandler ¶
type LoginHandler interface {
Login(http.ResponseWriter, *http.Request, *LoginRequest) (*LoginResponse, error)
}
LoginHandler provides server-side handling of a LoginRequest.
type LoginRequest ¶
type LoginRequest struct { ClaimedID string Identity string ReturnTo string Realm string Extensions []Extension }
LoginRequest represents an openid login request.
type LoginResponse ¶
type LoginResponse struct { ClaimedID string Identity string OPEndpoint string Extensions []Extension }
LoginResponse represents the response to an openid login request.
type MemoryAssociationStore ¶
type MemoryAssociationStore struct {
// contains filtered or unexported fields
}
MemoryAssociationStore is an in memory implementation of AssociationStore.
func NewMemoryAssociationStore ¶
func NewMemoryAssociationStore() *MemoryAssociationStore
NewMemoryAssociationStore creates a new in memory AssocationStore.
func (*MemoryAssociationStore) Add ¶
func (s *MemoryAssociationStore) Add(a *Association) error
Add implements AssociationStore.Add.
func (*MemoryAssociationStore) Delete ¶
func (s *MemoryAssociationStore) Delete(endpoint, handle string) error
Delete implements AssociationStore.Delete.
func (*MemoryAssociationStore) Find ¶
func (s *MemoryAssociationStore) Find(endpoint string) ([]*Association, error)
Find implements AssociationStore.Find.
func (*MemoryAssociationStore) Get ¶
func (s *MemoryAssociationStore) Get(endpoint, handle string) (*Association, error)
Get implements AssociationStore.Get.