mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-22 02:38:30 +00:00
fix: check return of consent request and don't send context (apparently)
This commit is contained in:
parent
6a625b0957
commit
139989fc01
@ -32,6 +32,7 @@ package obsidianimplv1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/gogo/status"
|
"github.com/gogo/status"
|
||||||
client "github.com/ory/hydra-client-go/v2"
|
client "github.com/ory/hydra-client-go/v2"
|
||||||
"peridot.resf.org/utils"
|
"peridot.resf.org/utils"
|
||||||
@ -43,6 +44,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
authError = "auth_error"
|
authError = "auth_error"
|
||||||
noUser = "no_user"
|
noUser = "no_user"
|
||||||
|
badConsent = "bad_consent"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) ProcessLoginRequest(challenge string) (*obsidianpb.SessionStatusResponse, error) {
|
func (s *Server) ProcessLoginRequest(challenge string) (*obsidianpb.SessionStatusResponse, error) {
|
||||||
@ -104,7 +106,6 @@ func (s *Server) AcceptConsentRequest(ctx context.Context, challenge string, con
|
|||||||
consent, _, err := s.hydra.OAuth2API.AcceptOAuth2ConsentRequest(ctx).
|
consent, _, err := s.hydra.OAuth2API.AcceptOAuth2ConsentRequest(ctx).
|
||||||
ConsentChallenge(challenge).
|
ConsentChallenge(challenge).
|
||||||
AcceptOAuth2ConsentRequest(client.AcceptOAuth2ConsentRequest{
|
AcceptOAuth2ConsentRequest(client.AcceptOAuth2ConsentRequest{
|
||||||
Context: ctx,
|
|
||||||
Remember: utils.Pointer[bool](true),
|
Remember: utils.Pointer[bool](true),
|
||||||
GrantScope: consentReq.RequestedScope,
|
GrantScope: consentReq.RequestedScope,
|
||||||
GrantAccessTokenAudience: consentReq.RequestedAccessTokenAudience,
|
GrantAccessTokenAudience: consentReq.RequestedAccessTokenAudience,
|
||||||
@ -121,6 +122,11 @@ func (s *Server) AcceptConsentRequest(ctx context.Context, challenge string, con
|
|||||||
},
|
},
|
||||||
}).Execute()
|
}).Execute()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
s.log.Error(err)
|
||||||
|
return nil, status.Error(codes.Internal, badConsent)
|
||||||
|
}
|
||||||
|
|
||||||
return &obsidianpb.SessionStatusResponse{
|
return &obsidianpb.SessionStatusResponse{
|
||||||
Valid: true,
|
Valid: true,
|
||||||
RedirectUrl: consent.RedirectTo,
|
RedirectUrl: consent.RedirectTo,
|
||||||
|
Loading…
Reference in New Issue
Block a user