Documentation ¶
Overview ¶
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
Index ¶
- Constants
- func Get(app, provider, pArn, awsRegion string, duration int32) (*aws.Credentials, error)
- type Client
- func (c *Client) GenerateSamlAssertion(token string, p *GenerateSamlAssertionParams) (*GenerateSamlAssertionResponse, error)
- func (c *Client) GenerateTokens(clientID, clientSecret string) (string, error)
- func (c *Client) VerifyFactor(token string, p *VerifyFactorParams) (*VerifyFactorResponse, error)
- type Device
- type Endpoints
- type GenerateSamlAssertionParams
- type GenerateSamlAssertionResponse
- type GenerateTokensParams
- type GenerateTokensResponse
- type GetUserByEmailResponse
- type VerifyFactorParams
- type VerifyFactorResponse
Constants ¶
const ( // GenerateSamlAssertionPath - OneLogin API endpoint to generate a SAML assertions GenerateSamlAssertionPath string = "/api/2/saml_assertion" // GenerateTokensPath - OneLogin API endpoint to generate an access token and refresh token GenerateTokensPath string = "/auth/oauth2/v2/token" // GetUserByEmailPath - OneLogin API endpoint to get a paginated list of users via email address GetUserByEmailPath string = "/api/2/users?email=%s" // VerifyFactorPath - OneLogin API endpoint to verify a one-time password (OTP) value VerifyFactorPath string = "/api/2/saml_assertion/verify_factor" )
const ( // MFADeviceOneLoginProtect symbolizes the OneLogin Protect mobile app, which supports push // notifications. More info here: https://developers.onelogin.com/api-docs/1/saml-assertions/verify-factor MFADeviceOneLoginProtect = "OneLogin Protect" // MFAPushTimeout represents the number of seconds to wait for a successful push attempt before // falling back to OTP input. MFAPushTimeout = 30 // MFAInterval represents the interval at which we check for an accepted push message. MFAInterval = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client represents a OneLogin API client.
func (*Client) GenerateSamlAssertion ¶
func (c *Client) GenerateSamlAssertion(token string, p *GenerateSamlAssertionParams) (*GenerateSamlAssertionResponse, error)
GenerateSamlAssertion gets a OneLogin access token and a GenerateSamlAssertionParams struct and returns a GenerateSamlAssertionResponse. TODO improve doc
func (*Client) GenerateTokens ¶
GenerateTokens generates the tokens required for interacting with the OneLogin API.
func (*Client) VerifyFactor ¶
func (c *Client) VerifyFactor(token string, p *VerifyFactorParams) (*VerifyFactorResponse, error)
VerifyFactor gets a OneLogin access token and a VerifyFactorParams struct and returns a VerifyFactorResponse.
type Endpoints ¶
type Endpoints struct { Region string // contains filtered or unexported fields }
Endpoints represent the OneLogin API HTTP endpoints.
func (Endpoints) GenerateSamlAssertion ¶
GenerateSamlAssertion will return a the relevant Generate SAML Assertion endpoint for a given base URL
func (Endpoints) GenerateTokens ¶
GenerateTokens will return the relevant Generate Tokens endpoint for a base URL
func (Endpoints) GetUserByEmail ¶
GetUserByEmail will, given an email address, return a valid url to search the Users endpoint by email address
func (Endpoints) VerifyFactor ¶
VerifyFactor will return a valid URL for requests to check MFA tokens
type GenerateSamlAssertionResponse ¶
type GenerateSamlAssertionResponse struct { StateToken string `json:"state_token"` Message string `json:"message"` Devices []Device CallbackURL string `json:"callback_url"` User struct { Lastname string `json:"lastname"` Username string `json:"username"` Email string `json:"email"` Firstname string `json:"firstname"` ID int `json:"id"` } Data string `json:"data"` }
TODO This one assumes MFA is enabled. Need to handle all cases.
type GenerateTokensParams ¶
type GenerateTokensParams struct {
GrantType string `json:"grant_type"`
}