mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
refactor(auth): expose only the login url
This commit is contained in:
parent
4cbde7bb0d
commit
24f066716b
3 changed files with 9 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
package settings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
httperror "github.com/portainer/libhttp/error"
|
||||
|
@ -15,10 +16,7 @@ type publicSettingsResponse struct {
|
|||
AllowPrivilegedModeForRegularUsers bool `json:"AllowPrivilegedModeForRegularUsers"`
|
||||
EnableHostManagementFeatures bool `json:"EnableHostManagementFeatures"`
|
||||
ExternalTemplates bool `json:"ExternalTemplates"`
|
||||
AuthorizationURI string `json:"AuthorizationURI"`
|
||||
ClientID string `json:"ClientID"`
|
||||
RedirectURI string `json:"RedirectURI"`
|
||||
Scopes string `json:"Scopes"`
|
||||
OAuthLoginURI string `json:"OAuthLoginURI"`
|
||||
}
|
||||
|
||||
// GET request on /api/settings/public
|
||||
|
@ -35,10 +33,11 @@ func (handler *Handler) settingsPublic(w http.ResponseWriter, r *http.Request) *
|
|||
AllowPrivilegedModeForRegularUsers: settings.AllowPrivilegedModeForRegularUsers,
|
||||
EnableHostManagementFeatures: settings.EnableHostManagementFeatures,
|
||||
ExternalTemplates: false,
|
||||
AuthorizationURI: settings.OAuthSettings.AuthorizationURI,
|
||||
ClientID: settings.OAuthSettings.ClientID,
|
||||
RedirectURI: settings.OAuthSettings.RedirectURI,
|
||||
Scopes: settings.OAuthSettings.Scopes,
|
||||
OAuthLoginURI: fmt.Sprintf("%s?response_type=code&client_id=%s&redirect_uri=%s&scope=%s&state=portainer",
|
||||
settings.OAuthSettings.AuthorizationURI,
|
||||
settings.OAuthSettings.ClientID,
|
||||
settings.OAuthSettings.RedirectURI,
|
||||
settings.OAuthSettings.Scopes),
|
||||
}
|
||||
|
||||
if settings.TemplatesURL != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue