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

Method GetOAuthPendingSession

internal/service/auth_service.go:733–752  ·  view source on GitHub ↗
(sessionId string)

Source from the content-addressed store, hash-verified

731}
732
733func (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
754func (auth *AuthService) ensureOAuthSessionLimit() {
755 auth.oauthMutex.Lock()

Callers 5

GetOAuthURLMethod · 0.95
GetOAuthTokenMethod · 0.95
GetOAuthUserinfoMethod · 0.95
GetOAuthServiceMethod · 0.95
oauthCallbackHandlerMethod · 0.80

Calls 1

Tested by

no test coverage detected