Documentation
¶
Overview ¶
Copyright © 2024 Alexandre Pires
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2024 Alexandre Pires ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2024 Alexandre Pires ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2024 Alexandre Pires ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2024 Alexandre Pires ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2024 Alexandre Pires ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func AddUser(username, password string) error
- func AuthenticateUser(username, password string) bool
- func ChangePassword(username, password string) error
- func DropUsers() error
- func GetRole(username string) (string, error)
- func GetUsers() ([]string, error)
- func HashPassword(password string) string
- func InitializeAuthProvider(provider string, config json.RawMessage) error
- func LoadUsers() error
- func RemoveUser(username string) error
- func SetAuthProviderFactory(factory AuthProviderFactory, config json.RawMessage)
- func SetRole(username, role string) error
- type AuthProvider
- type AuthProviderFactory
- type FileAuthProvider
- func (a *FileAuthProvider) AddUser(username, password string) error
- func (a *FileAuthProvider) AuthenticateUser(username, password string) bool
- func (a *FileAuthProvider) ChangePassword(username, password string) error
- func (a *FileAuthProvider) DropUsers() error
- func (a *FileAuthProvider) GetRole(username string) (string, error)
- func (a *FileAuthProvider) GetUser(username string) (UserView, error)
- func (a *FileAuthProvider) GetUsers() ([]string, error)
- func (a *FileAuthProvider) LoadUsers() error
- func (a *FileAuthProvider) RemoveUser(username string) error
- func (a *FileAuthProvider) SetRole(username, role string) error
- type FileAuthProviderConfig
- type MemoryAuthProvide
- func (a *MemoryAuthProvide) AddUser(username, password string) error
- func (a *MemoryAuthProvide) AuthenticateUser(username, password string) bool
- func (a *MemoryAuthProvide) ChangePassword(username, password string) error
- func (a *MemoryAuthProvide) DropUsers() error
- func (a *MemoryAuthProvide) GetRole(username string) (string, error)
- func (a *MemoryAuthProvide) GetUser(username string) (UserView, error)
- func (a *MemoryAuthProvide) GetUsers() ([]string, error)
- func (a *MemoryAuthProvide) LoadUsers() error
- func (a *MemoryAuthProvide) RemoveUser(username string) error
- func (a *MemoryAuthProvide) SetRole(username, role string) error
- type NullAuthProvider
- func (a *NullAuthProvider) AddUser(username, password string) error
- func (a *NullAuthProvider) AuthenticateUser(username, password string) bool
- func (a *NullAuthProvider) ChangePassword(username, password string) error
- func (a *NullAuthProvider) DropUsers() error
- func (a *NullAuthProvider) GetRole(username string) (string, error)
- func (a *NullAuthProvider) GetUser(username string) (UserView, error)
- func (a *NullAuthProvider) GetUsers() ([]string, error)
- func (a *NullAuthProvider) LoadUsers() error
- func (a *NullAuthProvider) RemoveUser(username string) error
- func (a *NullAuthProvider) SetRole(username, role string) error
- type User
- type UserView
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateUser ¶
func ChangePassword ¶
func HashPassword ¶
func InitializeAuthProvider ¶
func InitializeAuthProvider(provider string, config json.RawMessage) error
func RemoveUser ¶
func SetAuthProviderFactory ¶
func SetAuthProviderFactory(factory AuthProviderFactory, config json.RawMessage)
Types ¶
type AuthProvider ¶
type AuthProvider interface { AuthenticateUser(username, password string) bool AddUser(username, password string) error RemoveUser(username string) error GetRole(username string) (string, error) SetRole(username, role string) error GetUsers() ([]string, error) ChangePassword(username, password string) error DropUsers() error LoadUsers() error GetUser(username string) (UserView, error) }
func GetAuthProvider ¶
func GetAuthProvider() AuthProvider
func NewFileAuthProvider ¶
func NewFileAuthProvider(config json.RawMessage) AuthProvider
func NewMemoryAuthProvider ¶
func NewMemoryAuthProvider(config json.RawMessage) AuthProvider
func NewNullAuthProvider ¶
func NewNullAuthProvider(config json.RawMessage) AuthProvider
type AuthProviderFactory ¶
type AuthProviderFactory func(config json.RawMessage) AuthProvider
type FileAuthProvider ¶
type FileAuthProvider struct { AuthProvider // contains filtered or unexported fields }
func (*FileAuthProvider) AddUser ¶
func (a *FileAuthProvider) AddUser(username, password string) error
func (*FileAuthProvider) AuthenticateUser ¶
func (a *FileAuthProvider) AuthenticateUser(username, password string) bool
func (*FileAuthProvider) ChangePassword ¶
func (a *FileAuthProvider) ChangePassword(username, password string) error
func (*FileAuthProvider) DropUsers ¶
func (a *FileAuthProvider) DropUsers() error
func (*FileAuthProvider) GetRole ¶ added in v0.1.0
func (a *FileAuthProvider) GetRole(username string) (string, error)
func (*FileAuthProvider) GetUser ¶ added in v0.1.0
func (a *FileAuthProvider) GetUser(username string) (UserView, error)
func (*FileAuthProvider) GetUsers ¶
func (a *FileAuthProvider) GetUsers() ([]string, error)
func (*FileAuthProvider) LoadUsers ¶
func (a *FileAuthProvider) LoadUsers() error
func (*FileAuthProvider) RemoveUser ¶
func (a *FileAuthProvider) RemoveUser(username string) error
func (*FileAuthProvider) SetRole ¶ added in v0.1.0
func (a *FileAuthProvider) SetRole(username, role string) error
type FileAuthProviderConfig ¶
type FileAuthProviderConfig struct {
FilePath string `json:"file_path"`
}
type MemoryAuthProvide ¶
type MemoryAuthProvide struct { AuthProvider // contains filtered or unexported fields }
func (*MemoryAuthProvide) AddUser ¶
func (a *MemoryAuthProvide) AddUser(username, password string) error
func (*MemoryAuthProvide) AuthenticateUser ¶
func (a *MemoryAuthProvide) AuthenticateUser(username, password string) bool
func (*MemoryAuthProvide) ChangePassword ¶
func (a *MemoryAuthProvide) ChangePassword(username, password string) error
func (*MemoryAuthProvide) DropUsers ¶
func (a *MemoryAuthProvide) DropUsers() error
func (*MemoryAuthProvide) GetRole ¶ added in v0.1.0
func (a *MemoryAuthProvide) GetRole(username string) (string, error)
func (*MemoryAuthProvide) GetUser ¶ added in v0.1.0
func (a *MemoryAuthProvide) GetUser(username string) (UserView, error)
func (*MemoryAuthProvide) GetUsers ¶
func (a *MemoryAuthProvide) GetUsers() ([]string, error)
func (*MemoryAuthProvide) LoadUsers ¶
func (a *MemoryAuthProvide) LoadUsers() error
func (*MemoryAuthProvide) RemoveUser ¶
func (a *MemoryAuthProvide) RemoveUser(username string) error
func (*MemoryAuthProvide) SetRole ¶ added in v0.1.0
func (a *MemoryAuthProvide) SetRole(username, role string) error
type NullAuthProvider ¶
type NullAuthProvider struct {
AuthProvider
}
func (*NullAuthProvider) AddUser ¶
func (a *NullAuthProvider) AddUser(username, password string) error
func (*NullAuthProvider) AuthenticateUser ¶
func (a *NullAuthProvider) AuthenticateUser(username, password string) bool
func (*NullAuthProvider) ChangePassword ¶
func (a *NullAuthProvider) ChangePassword(username, password string) error
func (*NullAuthProvider) DropUsers ¶
func (a *NullAuthProvider) DropUsers() error
func (*NullAuthProvider) GetRole ¶ added in v0.1.0
func (a *NullAuthProvider) GetRole(username string) (string, error)
func (*NullAuthProvider) GetUser ¶ added in v0.1.0
func (a *NullAuthProvider) GetUser(username string) (UserView, error)
func (*NullAuthProvider) GetUsers ¶
func (a *NullAuthProvider) GetUsers() ([]string, error)
func (*NullAuthProvider) LoadUsers ¶
func (a *NullAuthProvider) LoadUsers() error
func (*NullAuthProvider) RemoveUser ¶
func (a *NullAuthProvider) RemoveUser(username string) error
func (*NullAuthProvider) SetRole ¶ added in v0.1.0
func (a *NullAuthProvider) SetRole(username, role string) error