mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-19 19:17:01 -07:00
Initial commit
This commit is contained in:
commit
c04107cf3d
6 changed files with 131 additions and 0 deletions
35
main.go
Normal file
35
main.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"davidallendj/ochami-auth/oidc"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
clientId = ""
|
||||
redirectUri = ""
|
||||
state = ""
|
||||
response_type = "code"
|
||||
userDB = ""
|
||||
)
|
||||
|
||||
func buildAuthorizationUrl(authEndpoint string, clientId string, redirectUri []string, state string, responseType string, scope []string) string {
|
||||
return authEndpoint + "?" + "cilent_id=" + clientId +
|
||||
"&redirect_url=" + strings.Join(redirectUri, ",") +
|
||||
"&response_type=" + responseType +
|
||||
"&state=" + state +
|
||||
"&scope=" + strings.Join(scope, "+")
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
client := oidc.NewOpenIDConnect()
|
||||
var authorizationUrl = buildAuthorizationUrl(
|
||||
client.
|
||||
)
|
||||
var tokenUrl = loginHost + tokenEndpoint
|
||||
// start a HTTP server to listen for callback responses
|
||||
// extract code from response and exchange for bearer token
|
||||
// extract ID token and save user info
|
||||
// use ID token/user info to get access token from Hydra
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue