fix: bug with authorizer url

This commit is contained in:
Lakhan Samani
2022-01-31 11:35:24 +05:30
parent 34a91f3195
commit 4e48320cf1
60 changed files with 156 additions and 148 deletions

View File

@@ -34,3 +34,16 @@ func SaveSessionInDB(userId string, c *gin.Context) {
log.Println("=> session saved in db:", sessionData)
}
}
// RemoveDuplicateString removes duplicate strings from a string slice
func RemoveDuplicateString(strSlice []string) []string {
allKeys := make(map[string]bool)
list := []string{}
for _, item := range strSlice {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}

View File

@@ -1,10 +1,23 @@
package utils
import (
"log"
"net/url"
"strings"
"github.com/gin-gonic/gin"
)
// GetHost returns hostname from request context
func GetHost(c *gin.Context) string {
scheme := "http"
if c.Request.TLS != nil {
scheme = "https"
}
log.Println("=> url:", scheme+"://"+c.Request.Host)
return scheme + "://" + c.Request.Host
}
// GetHostName function returns hostname and port
func GetHostParts(uri string) (string, string) {
tempURI := uri