Files
Vincent Bernat 3a6ba16a2e
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
console/authentication: template logout and avatar URLs if not provided
2025-10-19 15:54:07 +02:00

49 lines
1.5 KiB
Go

// SPDX-FileCopyrightText: 2022 Free Mobile
// SPDX-License-Identifier: AGPL-3.0-only
package authentication
// Configuration describes the configuration for the authentication component.
type Configuration struct {
// Headers define authentication headers
Headers ConfigurationHeaders
// DefaultUser define the default user when no authentication
// headers are present. Leave `Login' empty to not allow access
// without authentication.
DefaultUser UserInformation
// LogoutURL is the URL to logout an authenticated user. If not empty, it is
// templated from other information available about the user, including the
// one from the headers.
LogoutURL string
// AvatarURL is the URL to the avatar of an authenticated user. If not
// empty, it is templated from other information available about the user,
// including the one from the headers.
AvatarURL string
}
// ConfigurationHeaders define headers used for authentication
type ConfigurationHeaders struct {
Login string
Name string
Email string
LogoutURL string
AvatarURL string
}
// DefaultConfiguration represents the default configuration for the console component.
func DefaultConfiguration() Configuration {
return Configuration{
Headers: ConfigurationHeaders{
Login: "Remote-User",
Name: "Remote-Name",
Email: "Remote-Email",
LogoutURL: "X-Logout-URL",
AvatarURL: "X-Avatar-URL",
},
DefaultUser: UserInformation{
Login: "__default",
Name: "Default User",
},
}
}