photoprism/internal/session/session_get.go
Michael Mayer 0e4d81853c API: Add .well-known/oauth-authorization-server route handler #808 #3943
This commit also adds an /api/v1/oauth/logout endpoint that allows
clients to delete their sessions (access tokens) as needed.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-08 14:53:39 +01:00

23 lines
470 B
Go

package session
import (
"fmt"
"github.com/photoprism/photoprism/internal/entity"
)
// Get returns an existing client session.
func (s *Session) Get(id string) (m *entity.Session, err error) {
if id == "" {
return &entity.Session{}, fmt.Errorf("invalid session id")
}
return entity.FindSession(id)
}
// Exists checks whether a client session with the specified ID exists.
func (s *Session) Exists(id string) bool {
_, err := s.Get(id)
return err == nil
}