package controllers import ( "fmt" "net/http" "code.crute.us/mcrute/ssh-proxy/app/models" "github.com/labstack/echo/v4" ) type Oauth2DiscoveryController struct { Hostname string } func (d *Oauth2DiscoveryController) Handle(c echo.Context) error { return c.JSON(http.StatusOK, models.OauthDiscoveryMetadata{ Issuer: d.Hostname, AuthorizationEndpoint: fmt.Sprintf("%s/auth/login", d.Hostname), // Not really supported here TokenEndpoint: fmt.Sprintf("%s/auth/token", d.Hostname), DeviceAuthorizationEndpoint: fmt.Sprintf("%s/auth/device", d.Hostname), SupportedResponseTypes: []string{models.ResponseTypeCode}, SupportedGrantTypes: []string{models.GrantTypeDevice}, SupportedResponseModes: []string{models.ResponseModeQuery}, SupportedUILocales: []string{"en-us"}, SupportedChallengeCodeMethods: []string{models.ChallengeTypeSHA256}, }) }