blob: 15528e6c73fa43f80d5c32404c1533a4ea60ffec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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},
})
}
|