WIP refactoring login

This commit is contained in:
David J. Allen 2024-04-18 16:02:43 -06:00
parent 2e117bea36
commit 61a35c165d
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
2 changed files with 16 additions and 0 deletions

View file

@ -85,6 +85,11 @@ var loginCmd = &cobra.Command{
os.Exit(1)
}
// use clients to make SSO buttons that
for _, client := range config.Authentication.Clients {
MakeButton()
}
// start the listener
err := opaal.Login(&config, &client, provider)
if err != nil {
@ -115,3 +120,13 @@ func init() {
loginCmd.MarkFlagsMutuallyExclusive("target.name", "target.index")
rootCmd.AddCommand(loginCmd)
}
func MakeButton(url string, text string) string {
// check if we have http:// a
html := "<input type=\"button\" "
html += "class=\"button\" "
html += fmt.Sprintf("onclick=\"window.location.href='%s';\" ", url)
html += fmt.Sprintf("value=\"%s\"", text)
return html
// return "<a href=\"" + url + "\"> " + text + "</a>"
}

View file

@ -93,6 +93,7 @@ func (s *Server) StartLogin(buttons string, provider *oidc.IdentityProvider, cli
// add target if query exists
if r != nil {
target = r.URL.Query().Get("target")
sso := r.URL.Query().Get("sso")
}
// show login page with notice to redirect
template, err := gonja.FromFile("pages/index.html")