Skip to content

Commit

Permalink
Merge pull request #134 from rgooch/fix-oauth2-login
Browse files Browse the repository at this point in the history
Fix OAuth2 login redirection and bump release version.
  • Loading branch information
rgooch authored Oct 8, 2021
2 parents 0bab11b + 748d2b1 commit eeda9dd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endif
BINARY=keymaster

# These are the values we want to pass for Version and BuildTime
VERSION=1.9.0
VERSION=1.9.1
#BUILD_TIME=`date +%FT%T%z`

# Setup the -ldflags option for go build here, interpolate the variable values
Expand Down
2 changes: 1 addition & 1 deletion cmd/keymasterd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ func genRandomString() (string, error) {
// // is interpreted as: use whatever protocol you think is OK
func getLoginDestination(r *http.Request) string {
loginDestination := profilePath
if r.Form.Get("login_destination") != "" {
if r.FormValue("login_destination") != "" {
inboundLoginDestination := r.Form.Get("login_destination")
if strings.HasPrefix(inboundLoginDestination, "/") &&
!strings.HasPrefix(inboundLoginDestination, "//") {
Expand Down
12 changes: 5 additions & 7 deletions cmd/keymasterd/templateData.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const footerTemplateText = `
<div class="footer">
<hr>
<center>
Copright 2017-2019 Symantec Corporation; 2019-2020 Cloud-Foundations.org.
Copyright 2017-2019 Symantec Corporation; 2019-2021 Cloud-Foundations.org.
{{template "footer_extra"}}
</center>
</div>
Expand Down Expand Up @@ -63,16 +63,14 @@ const loginFormText = `
{{end}}
{{if .ShowOauth2}}
<p>
{{if .LoginDestination}}
<form enctype="application/x-www-form-urlencoded" action="/auth/oauth2/login" method="post">
{{if .LoginDestination}}
<INPUT TYPE="hidden" NAME="login_destination" VALUE={{.LoginDestination}}>
<p><input type="submit" value="Oauth2 Login" /></p>
</form>
{{else}}
<a href="/auth/oauth2/login">Oauth2 Login</a>
{{end}}
<p><input type="submit" value="Oauth2 Login" /></p>
</form>
</p>
{{end}}
{{end}}
{{template "login_pre_password" .}}
<form enctype="application/x-www-form-urlencoded" action="/api/v0/login" method="post">
{{if .DefaultUsername}}
Expand Down
2 changes: 1 addition & 1 deletion keymaster.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: keymaster
Version: 1.9.0
Version: 1.9.1
Release: 1%{?dist}
Summary: Short term access certificate generator and client

Expand Down

0 comments on commit eeda9dd

Please sign in to comment.