Compare commits
4 Commits
1.1.21.bet
...
1.1.21.bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a68876a6f4 | ||
![]() |
2c867b0314 | ||
![]() |
74b858ac24 | ||
![]() |
fedc3173fe |
@@ -42,6 +42,7 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
scopeString := strings.TrimSpace(gc.Query("scope"))
|
||||
clientID := strings.TrimSpace(gc.Query("client_id"))
|
||||
responseMode := strings.TrimSpace(gc.Query("response_mode"))
|
||||
nonce := strings.TrimSpace(gc.Query("nonce"))
|
||||
|
||||
var scope []string
|
||||
if scopeString == "" {
|
||||
@@ -78,11 +79,13 @@ func AuthorizeHandler() gin.HandlerFunc {
|
||||
})
|
||||
|
||||
code := uuid.New().String()
|
||||
nonce := uuid.New().String()
|
||||
if nonce == "" {
|
||||
nonce = uuid.New().String()
|
||||
}
|
||||
memorystore.Provider.SetState(codeChallenge, code)
|
||||
|
||||
// used for response mode query or fragment
|
||||
loginState := "state=" + state + "&scope=" + strings.Join(scope, " ") + "&redirect_uri=" + redirectURI + "&code=" + code + "&nonce=" + nonce
|
||||
loginState := "state=" + state + "&scope=" + strings.Join(scope, " ") + "&redirect_uri=" + redirectURI + "&code=" + code
|
||||
loginURL := "/app?" + loginState
|
||||
|
||||
if responseMode == constants.ResponseModeFragment {
|
||||
|
@@ -17,7 +17,7 @@ func OpenIDConfigurationHandler() gin.HandlerFunc {
|
||||
c.JSON(200, gin.H{
|
||||
"issuer": issuer,
|
||||
"authorization_endpoint": issuer + "/authorize",
|
||||
"token_endpoint": issuer + "/token",
|
||||
"token_endpoint": issuer + "/oauth/token",
|
||||
"userinfo_endpoint": issuer + "/userinfo",
|
||||
"jwks_uri": issuer + "/.well-known/jwks.json",
|
||||
"response_types_supported": []string{"code", "token", "id_token"},
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
func TokenHandler() gin.HandlerFunc {
|
||||
return func(gc *gin.Context) {
|
||||
var reqBody map[string]string
|
||||
if err := gc.Bind(&reqBody); err != nil {
|
||||
if err := gc.BindJSON(&reqBody); err != nil {
|
||||
log.Debug("Error binding JSON: ", err)
|
||||
gc.JSON(http.StatusBadRequest, gin.H{
|
||||
"error": "error_binding_json",
|
||||
|
@@ -91,7 +91,7 @@ func GetDomainName(uri string) string {
|
||||
return host
|
||||
}
|
||||
|
||||
// GetAppURL to get /app/ url if not configured by user
|
||||
// GetAppURL to get /app url if not configured by user
|
||||
func GetAppURL(gc *gin.Context) string {
|
||||
envAppURL, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
if envAppURL == "" || err != nil {
|
||||
|
Reference in New Issue
Block a user