Documentation
¶
Index ¶
Constants ¶
const ( // DefaultUnameKey is used to post auth information DefaultUnameKey = "j_username" // DefaultPasswdKey is used as well as DefaultUnameKey DefaultPasswdKey = "j_password" // DefaultRelayStateKey is the key to parse HTML and extract saml auth information. DefaultRelayStateKey = "RelayState" // DefaultSAMLResponseKey is used as well as DefaultRelayStateKey DefaultSAMLResponseKey = "SAMLResponse" // DefaultAuthDomain is the domain of auth server. DefaultAuthDomain = "auth.cis.kit.ac.jp" // ShibbolethLoginURL is the default login url. ShibbolethLoginURL = "https://portal.student.kit.ac.jp/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth interface {
LoginWith(client *http.Client) error
SetupWith(config Config) error
LoginAs(username string, password string) error
}
Auth is an interface for http.Client
type Config ¶
type Config struct {
// Username key is used when this module POST auth information to auth server.
ShibbolethUsernameKey string
// Password key is used as well as Username key.
ShibbolethPasswordKey string
// Domain information of auth server.
ShibbolethAuthDomain string
// Url to login
ShibbolethLoginURL string
// This params has an additionally information to auth.
// POST with username and password.
ShibbolethHiddenParams url.Values
// When appear webstorage confirmation during authentication steps, this params send to the server.
ShibbolethPassConfirmationParams url.Values
}
Config struct will have settings for saml authentication.
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
GetDefaultConfig will return the default configuration. It is enough to authenticate typically.
type ConfigDoesNotExists ¶
type ConfigDoesNotExists struct{}
ConfigDoesNotExists will raise when some configurations are missing.
func (*ConfigDoesNotExists) Error ¶
func (e *ConfigDoesNotExists) Error() string
type InvalidUsernameError ¶
type InvalidUsernameError struct {
// contains filtered or unexported fields
}
InvalidUsernameError will be return when given user name is invalid.
func (*InvalidUsernameError) Error ¶
func (e *InvalidUsernameError) Error() string
type SamlAuthenticator ¶
type SamlAuthenticator struct {
User *User
Config Config
// contains filtered or unexported fields
}
SamlAuthenticator has Config and User. This struct implement Auth interface.
func (*SamlAuthenticator) LoginAs ¶
func (c *SamlAuthenticator) LoginAs(username string, password string) error
LoginAs switch user to authenticate with
func (*SamlAuthenticator) LoginWith ¶
func (c *SamlAuthenticator) LoginWith(client *http.Client) error
LoginWith works with given http.Client to auth. The client store cookie information to be used for next authentication.
func (*SamlAuthenticator) SetupWith ¶
func (c *SamlAuthenticator) SetupWith(config Config) error
SetupWith attach given configuration to authenticator.
type ShibbolethAuthError ¶
type ShibbolethAuthError struct {
// contains filtered or unexported fields
}
ShibbolethAuthError will raise when authentication has been failed.
func (*ShibbolethAuthError) Error ¶
func (e *ShibbolethAuthError) Error() string