feat: coverage prompt=none, response_mode=fragment (#385)

This commit is contained in:
David Sharnoff 2023-05-03 03:56:47 -07:00 committed by GitHub
parent e62473ba71
commit 157bc6ceb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 117 additions and 10 deletions

View file

@ -28,8 +28,10 @@ var serviceKey1 = &rsa.PublicKey{
E: 65537,
}
var _ op.Storage = &Storage{}
var _ op.ClientCredentialsStorage = &Storage{}
var (
_ op.Storage = &Storage{}
_ op.ClientCredentialsStorage = &Storage{}
)
// storage implements the op.Storage interface
// typically you would implement this as a layer on top of your database
@ -167,6 +169,12 @@ func (s *Storage) CreateAuthRequest(ctx context.Context, authReq *oidc.AuthReque
s.lock.Lock()
defer s.lock.Unlock()
if len(authReq.Prompt) == 1 && authReq.Prompt[0] == "none" {
// With prompt=none, there is no way for the user to log in
// so return error right away.
return nil, oidc.ErrLoginRequired()
}
// typically, you'll fill your storage / storage model with the information of the passed object
request := authRequestToInternal(authReq, userID)