This repository has been archived by the owner on Dec 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adding the build date to the version string
- Loading branch information
Showing
4 changed files
with
25 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,31 +17,34 @@ package main | |
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"net/http" | ||
"strconv" | ||
"time" | ||
|
||
"github.com/coreos/go-oidc/jose" | ||
) | ||
|
||
var ( | ||
release = "v2.1.0" | ||
gitsha = "no gitsha provided" | ||
version = release + " (git+sha: " + gitsha + ")" | ||
release = "v2.1.0" | ||
gitsha = "no gitsha provided" | ||
compiled = "0" | ||
version = "" | ||
) | ||
|
||
const ( | ||
prog = "keycloak-proxy" | ||
author = "Rohith" | ||
email = "[email protected]" | ||
description = "is a proxy using the keycloak service for auth and authorization" | ||
httpSchema = "http" | ||
|
||
headerUpgrade = "Upgrade" | ||
userContextName = "identity" | ||
revokeContextName = "revoke" | ||
authorizationHeader = "Authorization" | ||
versionHeader = "X-Auth-Proxy-Version" | ||
envPrefix = "PROXY_" | ||
httpSchema = "http" | ||
|
||
oauthURL = "/oauth" | ||
authorizationURL = "/authorize" | ||
|
@@ -229,10 +232,23 @@ type Config struct { | |
ForwardingDomains []string `json:"forwarding-domains" yaml:"forwarding-domains" usage:"list of domains which should be signed; everything else is relayed unsigned"` | ||
} | ||
|
||
// getVersion returns the proxy version | ||
func getVersion() string { | ||
if version == "" { | ||
tm, err := strconv.ParseInt(compiled, 10, 64) | ||
if err != nil { | ||
return "unable to parse compiled time" | ||
} | ||
version = fmt.Sprintf("git+sha: %s, built: %s", gitsha, time.Unix(tm, 0).Format("02/01/2006")) | ||
} | ||
|
||
return version | ||
} | ||
|
||
// storage is used to hold the offline refresh token, assuming you don't want to use | ||
// the default practice of a encrypted cookie | ||
type storage interface { | ||
// Add the token to the store | ||
// Set the token to the store | ||
Set(string, string) error | ||
// Get retrieves a token from the store | ||
Get(string) (string, error) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters