gin-oidc
golan oidc middleware - an OIDC client for a relying party web server
example usage
package main
import (
"context"
"net/http"
"golang.org/x/oauth2"
auth "gitlab.beopenit.com/mody/oidc-middleware"
)
var mux *http.ServeMux = http.NewServeMux()
......
func main() {
.....
ctx := context.Background()
provider, err := oidc.NewProvider(ctx, "http://localhost:9080/auth/realms/jhipster")
if err != nil {
panic(err)
}
config := oauth2.Config{
ClientID: "web_app",
ClientSecret: "web_app",
Endpoint: provider.Endpoint(),
RedirectURL: "http://localhost:8080/token",
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
}
auth.Init(config, "http://localhost:9080/auth/realms/jhipster", mux)
.....
}