Refactor previous COOPGO Identity service - Initial commit
This commit is contained in:
26
oidc-provider/endpoints_introspection.go
Normal file
26
oidc-provider/endpoints_introspection.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package op
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/ory/fosite"
|
||||
)
|
||||
|
||||
func (op *OIDCHandler) IntrospectionEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
namespace := mux.Vars(r)["namespace"]
|
||||
oauth2Provider := op.NamespaceProviders[namespace]
|
||||
|
||||
ctx := r.Context()
|
||||
mySessionData := new(fosite.DefaultSession)
|
||||
ir, err := oauth2Provider.NewIntrospectionRequest(ctx, r, mySessionData)
|
||||
if err != nil {
|
||||
log.Printf("Error occurred in NewIntrospectionRequest: %+v", err)
|
||||
oauth2Provider.WriteIntrospectionError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
oauth2Provider.WriteIntrospectionResponse(w, ir)
|
||||
}
|
||||
Reference in New Issue
Block a user