-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OIDC discovery and empty user info
- Loading branch information
Showing
17 changed files
with
289 additions
and
85 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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package http | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
type RequestData struct { | ||
Scheme string | ||
Host string | ||
Path string | ||
Query string | ||
Fragment string | ||
} | ||
|
||
func NewRequestData(r *http.Request) *RequestData { | ||
scheme := "http" | ||
if r.TLS != nil { | ||
scheme = "https" | ||
} | ||
|
||
query := "" | ||
if r.URL.RawQuery != "" { | ||
query = "?" + r.URL.RawQuery | ||
} | ||
fragment := "" | ||
if r.URL.RawFragment != "" { | ||
fragment = "#" + r.URL.RawFragment | ||
} | ||
return &RequestData{ | ||
Scheme: scheme, | ||
Host: r.Host, | ||
Path: r.URL.RawPath, | ||
Query: query, | ||
Fragment: fragment, | ||
} | ||
} | ||
|
||
func (r *RequestData) IssuerString() string { | ||
return fmt.Sprintf("%s://%s", r.Scheme, r.Host) | ||
} | ||
|
||
func (r *RequestData) URL() (*url.URL, error) { | ||
uri := fmt.Sprintf("%s://%s%s%s%s", r.Scheme, r.Host, r.Path, r.Query, r.Fragment) | ||
|
||
return url.Parse(uri) | ||
} |
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
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
Oops, something went wrong.