photoprism/internal/server/routes_wellknown.go
Michael Mayer 7ef544fa53 Docs: Improve inline comments of the internal/server package #782 #3943
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-10 12:46:00 +01:00

23 lines
868 B
Go

package server
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/internal/server/wellknown"
)
// registerWellknownRoutes adds "/.well-known/" service discovery routes.
func registerWellknownRoutes(router *gin.Engine, conf *config.Config) {
// Registers the "/.well-known/oauth-authorization-server" service discovery endpoint for OAuth2 clients.
router.Any(conf.BaseUri("/.well-known/oauth-authorization-server"), func(c *gin.Context) {
c.JSON(http.StatusOK, wellknown.NewOAuthAuthorizationServer(conf))
})
// Registers the "/.well-known/openid-configuration" service discovery endpoint for OpenID Connect clients.
router.Any(conf.BaseUri("/.well-known/openid-configuration"), func(c *gin.Context) {
c.JSON(http.StatusOK, wellknown.NewOpenIDConfiguration(conf))
})
}