Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions auth/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type PublicAuthUser struct {
type PublicAuthResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Status int `json:"status,omitempty"`
User PublicAuthUser `json:"user,omitempty"`
}

Expand All @@ -40,9 +41,9 @@ var transport = &http.Transport{

var sharedClient = &http.Client{Transport: transport}

func Public(appid string, ipAddr string) PublicAuthResponse {
func Public(appid, ipAddr, url, method string) PublicAuthResponse {
gw := utils.GetAuthServicePath(utils.DefaultHostnameProvider{})
authServicePath := fmt.Sprintf("%s/auth/public?appid=%s&ip=%s", gw, appid, ipAddr)
authServicePath := fmt.Sprintf("%s/auth/public?appid=%s&ip=%s&url=%s&method=%s", gw, appid, ipAddr, url, method)

req, err := http.NewRequest("GET", authServicePath, nil)
if err != nil {
Expand Down Expand Up @@ -73,6 +74,8 @@ func Public(appid string, ipAddr string) PublicAuthResponse {
return errorResponse(PublicAuthGenericError)
}

authResponseBody.Status = resp.StatusCode

if resp.StatusCode != http.StatusOK {
log.Error().Msgf("Failed to send request: %s", authResponseBody.Message)

Expand Down
Loading