(sessionId string)
| 731 | } |
| 732 | |
| 733 | func (auth *AuthService) GetOAuthPendingSession(sessionId string) (*OAuthPendingSession, error) { |
| 734 | auth.ensureOAuthSessionLimit() |
| 735 | |
| 736 | auth.oauthMutex.RLock() |
| 737 | session, exists := auth.oauthPendingSessions[sessionId] |
| 738 | auth.oauthMutex.RUnlock() |
| 739 | |
| 740 | if !exists { |
| 741 | return &OAuthPendingSession{}, fmt.Errorf("oauth session not found: %s", sessionId) |
| 742 | } |
| 743 | |
| 744 | if time.Now().After(session.ExpiresAt) { |
| 745 | auth.oauthMutex.Lock() |
| 746 | delete(auth.oauthPendingSessions, sessionId) |
| 747 | auth.oauthMutex.Unlock() |
| 748 | return &OAuthPendingSession{}, fmt.Errorf("oauth session expired: %s", sessionId) |
| 749 | } |
| 750 | |
| 751 | return session, nil |
| 752 | } |
| 753 | |
| 754 | func (auth *AuthService) ensureOAuthSessionLimit() { |
| 755 | auth.oauthMutex.Lock() |
no test coverage detected