MCPcopy
hub / github.com/tinyauthapp/tinyauth / authorizeError

Method authorizeError

internal/controller/oidc_controller.go:469–514  ·  view source on GitHub ↗
(c *gin.Context, err error, reason string, reasonUser string, callback string, callbackError string, state string)

Source from the content-addressed store, hash-verified

467}
468
469func (controller *OIDCController) authorizeError(c *gin.Context, err error, reason string, reasonUser string, callback string, callbackError string, state string) {
470 tlog.App.Error().Err(err).Msg(reason)
471
472 if callback != "" {
473 errorQueries := CallbackError{
474 Error: callbackError,
475 }
476
477 if reasonUser != "" {
478 errorQueries.ErrorDescription = reasonUser
479 }
480
481 if state != "" {
482 errorQueries.State = state
483 }
484
485 queries, err := query.Values(errorQueries)
486
487 if err != nil {
488 c.AbortWithStatus(http.StatusInternalServerError)
489 return
490 }
491
492 c.JSON(200, gin.H{
493 "status": 200,
494 "redirect_uri": fmt.Sprintf("%s?%s", callback, queries.Encode()),
495 })
496 return
497 }
498
499 errorQueries := ErrorScreen{
500 Error: reasonUser,
501 }
502
503 queries, err := query.Values(errorQueries)
504
505 if err != nil {
506 c.AbortWithStatus(http.StatusInternalServerError)
507 return
508 }
509
510 c.JSON(200, gin.H{
511 "status": 200,
512 "redirect_uri": fmt.Sprintf("%s/error?%s", controller.oidc.GetIssuer(), queries.Encode()),
513 })
514}

Callers 1

AuthorizeMethod · 0.95

Calls 1

GetIssuerMethod · 0.80

Tested by

no test coverage detected