Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
DefaultAuthServer = "auth.cern.ch" // Default authentication server name.
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Single Sign-On client.
func Login ¶
Login simulates a browser session to log in with the provided URL, using the SPNEGO protocol.
Example ¶
package main
import (
"fmt"
"log"
sso "github.com/sbinet/cern-sso"
)
func main() {
const url = "https://openstack.cern.ch"
cli, err := sso.Login(url)
if err != nil {
log.Fatalf("could not log into %q: %+v", url, err)
}
defer cli.Close()
for _, c := range cli.Cookies() {
scheme := "http"
if c.Secure {
scheme = "https"
}
fmt.Printf("%-20s %s\n", c.Name+":", scheme+"://"+c.Domain+c.Path)
}
}
func NewClient ¶
NewClient creates a new SSO client that will authenticate with the provided login page. The returned client is not yet authenticated: one should use the Login method to do so.
type Option ¶
func WithAuthServer ¶
WithAuthServer configures the authentication to use the passed authentication server name.
ex:
"auth.cern.ch"
func WithClient ¶
WithClient configures the authentication to use the passed HTTP client.
func WithCookieExpiration ¶ added in v0.4.0
WithCookieExpiration configures the default expiration for the SSO cookie.
func WithLogger ¶
WithLogger configures the authentication to use the passed logger.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cert provides an easy way to add CERN certificates to a Go application.
|
Package cert provides an easy way to add CERN certificates to a Go application. |
|
cmd
|
|
|
auth-cern-sso
command
Command auth-cern-sso authenticates with a CERN SSO protected site URL and stores cookies in a file, in the Netscape NTTP Cookie File format.
|
Command auth-cern-sso authenticates with a CERN SSO protected site URL and stores cookies in a file, in the Netscape NTTP Cookie File format. |
Click to show internal directories.
Click to hide internal directories.