feat: differentiate between "no available key" and error for redis sessions (#3093)
* add some better error handling * add changelog entry Signed-off-by: Jan Larwig <jan@larwig.com> --------- Signed-off-by: Jan Larwig <jan@larwig.com> Co-authored-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
		
							parent
							
								
									e75a258299
								
							
						
					
					
						commit
						f4b33b64bd
					
				|  | @ -16,6 +16,8 @@ | |||
| - [#3104](https://github.com/oauth2-proxy/oauth2-proxy/pull/3104) feat(cookie): add feature support for cookie-secret-file (@sandy2008) | ||||
| - [#3055](https://github.com/oauth2-proxy/oauth2-proxy/pull/3055) feat: support non-default authorization request response mode also for OIDC providers (@stieler-it) | ||||
| - [#3138](https://github.com/oauth2-proxy/oauth2-proxy/pull/3138) feat: make google_groups argument optional when using google provider (@sourava01) | ||||
| - [#3093](https://github.com/oauth2-proxy/oauth2-proxy/pull/3093) feat: differentiate between "no available key" and error for redis sessions (@nobletrout) | ||||
| 
 | ||||
| 
 | ||||
| # V7.10.0 | ||||
| 
 | ||||
|  |  | |||
|  | @ -49,9 +49,12 @@ func (store *SessionStore) Save(ctx context.Context, key string, value []byte, e | |||
| // cookie within the HTTP request object
 | ||||
| func (store *SessionStore) Load(ctx context.Context, key string) ([]byte, error) { | ||||
| 	value, err := store.Client.Get(ctx, key) | ||||
| 	if err != nil { | ||||
| 	if err == redis.Nil { | ||||
| 		return nil, fmt.Errorf("session does not exist") | ||||
| 	} else if err != nil { | ||||
| 		return nil, fmt.Errorf("error loading redis session: %v", err) | ||||
| 	} | ||||
| 
 | ||||
| 	return value, nil | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue