34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package identity
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/vincentc-afk/gitea-notification-hub/internal/event"
|
|
)
|
|
|
|
// ResolvedIdentity represents a resolved external identity
|
|
type ResolvedIdentity struct {
|
|
Email string `json:"email"`
|
|
SlackID string `json:"slack_id"`
|
|
SlackName string `json:"slack_name"`
|
|
}
|
|
|
|
// Resolver resolves Gitea users to external identities (e.g., Slack)
|
|
// This interface allows for different identity providers (Gitea API, LDAP, etc.)
|
|
type Resolver interface {
|
|
// Resolve returns the external identity for a Gitea user
|
|
Resolve(ctx context.Context, user event.User) (*ResolvedIdentity, error)
|
|
}
|
|
|
|
// EmailLookup provides email lookup functionality
|
|
type EmailLookup interface {
|
|
// LookupEmail looks up a user's email address by username
|
|
LookupEmail(ctx context.Context, username string) (string, error)
|
|
}
|
|
|
|
// SlackLookup provides Slack user lookup functionality
|
|
type SlackLookup interface {
|
|
// LookupSlackIDByEmail finds a Slack user ID by email
|
|
LookupSlackIDByEmail(ctx context.Context, email string) (slackID, slackName string, err error)
|
|
}
|