Added CLI and more functionality

This commit is contained in:
David Allen 2024-02-21 17:51:59 -07:00
parent c04107cf3d
commit 053095c412
12 changed files with 199 additions and 92 deletions

30
main.go
View file

@ -1,35 +1,11 @@
package main
import (
"davidallendj/ochami-auth/oidc"
"strings"
)
import "davidallendj/oidc-auth/cmd"
var (
clientId = ""
redirectUri = ""
state = ""
response_type = "code"
userDB = ""
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
cmd.Execute()
}