Documentation ¶
Index ¶
Constants ¶
const ( //BucketName is the name of the bucket created in the bolt database //to store authentication information. The BucketName is prepended to the //uri of the SecurityCenter instance. BucketName = "AuthBucket" //DB is the name of the bolt database file DB = "auth.db" //ETC is the Estimated Time to Complete session (e.g. how long until session self-destructs) ETC = 60 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
Delete will purge the local bolt database. Note this does not invalidate the session from SecurityCenter incase the currently used token is being used elsewhere. An option for also invalidating the session may be present in future iteration(s).
func Get ¶
Get returns the current token and sesion information for the current session if present. First, it will look at the flags passed to the binary at runtime (e.g. --token and --session). If those don't exist, it will look in the local bolt database file (auth.db).
func Set ¶
Set sets the session information based on the supplied `keys` map. These values are transalted as a key-value pair and are saved accordingly to the local auth.db bolt database file. On save, it sets the current `__timestamp` field to auto invalidate the session after a specified time.
func Test ¶
Test tests the current authentication information by making a simple request to the configured SecurityCenter instance. If the user is successfully authenticated, they will be greeted with their username and fullname while the function returns `true`. If not, they are shown an error and the function returns false.
Types ¶
This section is empty.