diff --git a/models/idp_list_configurations_response.go b/models/idp_list_configurations_response.go
new file mode 100644
index 0000000000..ddf263a743
--- /dev/null
+++ b/models/idp_list_configurations_response.go
@@ -0,0 +1,133 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "context"
+ "strconv"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/swag"
+)
+
+// IdpListConfigurationsResponse idp list configurations response
+//
+// swagger:model idpListConfigurationsResponse
+type IdpListConfigurationsResponse struct {
+
+ // results
+ Results []*IdpServerConfiguration `json:"results"`
+}
+
+// Validate validates this idp list configurations response
+func (m *IdpListConfigurationsResponse) Validate(formats strfmt.Registry) error {
+ var res []error
+
+ if err := m.validateResults(formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+func (m *IdpListConfigurationsResponse) validateResults(formats strfmt.Registry) error {
+ if swag.IsZero(m.Results) { // not required
+ return nil
+ }
+
+ for i := 0; i < len(m.Results); i++ {
+ if swag.IsZero(m.Results[i]) { // not required
+ continue
+ }
+
+ if m.Results[i] != nil {
+ if err := m.Results[i].Validate(formats); err != nil {
+ if ve, ok := err.(*errors.Validation); ok {
+ return ve.ValidateName("results" + "." + strconv.Itoa(i))
+ } else if ce, ok := err.(*errors.CompositeError); ok {
+ return ce.ValidateName("results" + "." + strconv.Itoa(i))
+ }
+ return err
+ }
+ }
+
+ }
+
+ return nil
+}
+
+// ContextValidate validate this idp list configurations response based on the context it is used
+func (m *IdpListConfigurationsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+ var res []error
+
+ if err := m.contextValidateResults(ctx, formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+func (m *IdpListConfigurationsResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
+
+ for i := 0; i < len(m.Results); i++ {
+
+ if m.Results[i] != nil {
+ if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
+ if ve, ok := err.(*errors.Validation); ok {
+ return ve.ValidateName("results" + "." + strconv.Itoa(i))
+ } else if ce, ok := err.(*errors.CompositeError); ok {
+ return ce.ValidateName("results" + "." + strconv.Itoa(i))
+ }
+ return err
+ }
+ }
+
+ }
+
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *IdpListConfigurationsResponse) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
+ }
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *IdpListConfigurationsResponse) UnmarshalBinary(b []byte) error {
+ var res IdpListConfigurationsResponse
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
+ return nil
+}
diff --git a/models/idp_server_configuration.go b/models/idp_server_configuration.go
new file mode 100644
index 0000000000..66af32712d
--- /dev/null
+++ b/models/idp_server_configuration.go
@@ -0,0 +1,145 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "context"
+ "strconv"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/swag"
+)
+
+// IdpServerConfiguration idp server configuration
+//
+// swagger:model idpServerConfiguration
+type IdpServerConfiguration struct {
+
+ // enabled
+ Enabled bool `json:"enabled,omitempty"`
+
+ // info
+ Info []*IdpServerConfigurationInfo `json:"info"`
+
+ // input
+ Input string `json:"input,omitempty"`
+
+ // name
+ Name string `json:"name,omitempty"`
+
+ // type
+ Type string `json:"type,omitempty"`
+}
+
+// Validate validates this idp server configuration
+func (m *IdpServerConfiguration) Validate(formats strfmt.Registry) error {
+ var res []error
+
+ if err := m.validateInfo(formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+func (m *IdpServerConfiguration) validateInfo(formats strfmt.Registry) error {
+ if swag.IsZero(m.Info) { // not required
+ return nil
+ }
+
+ for i := 0; i < len(m.Info); i++ {
+ if swag.IsZero(m.Info[i]) { // not required
+ continue
+ }
+
+ if m.Info[i] != nil {
+ if err := m.Info[i].Validate(formats); err != nil {
+ if ve, ok := err.(*errors.Validation); ok {
+ return ve.ValidateName("info" + "." + strconv.Itoa(i))
+ } else if ce, ok := err.(*errors.CompositeError); ok {
+ return ce.ValidateName("info" + "." + strconv.Itoa(i))
+ }
+ return err
+ }
+ }
+
+ }
+
+ return nil
+}
+
+// ContextValidate validate this idp server configuration based on the context it is used
+func (m *IdpServerConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+ var res []error
+
+ if err := m.contextValidateInfo(ctx, formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+func (m *IdpServerConfiguration) contextValidateInfo(ctx context.Context, formats strfmt.Registry) error {
+
+ for i := 0; i < len(m.Info); i++ {
+
+ if m.Info[i] != nil {
+ if err := m.Info[i].ContextValidate(ctx, formats); err != nil {
+ if ve, ok := err.(*errors.Validation); ok {
+ return ve.ValidateName("info" + "." + strconv.Itoa(i))
+ } else if ce, ok := err.(*errors.CompositeError); ok {
+ return ce.ValidateName("info" + "." + strconv.Itoa(i))
+ }
+ return err
+ }
+ }
+
+ }
+
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *IdpServerConfiguration) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
+ }
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *IdpServerConfiguration) UnmarshalBinary(b []byte) error {
+ var res IdpServerConfiguration
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
+ return nil
+}
diff --git a/models/idp_server_configuration_info.go b/models/idp_server_configuration_info.go
new file mode 100644
index 0000000000..2680d482e8
--- /dev/null
+++ b/models/idp_server_configuration_info.go
@@ -0,0 +1,76 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "context"
+
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/swag"
+)
+
+// IdpServerConfigurationInfo idp server configuration info
+//
+// swagger:model idpServerConfigurationInfo
+type IdpServerConfigurationInfo struct {
+
+ // is cfg
+ IsCfg bool `json:"isCfg,omitempty"`
+
+ // is env
+ IsEnv bool `json:"isEnv,omitempty"`
+
+ // key
+ Key string `json:"key,omitempty"`
+
+ // value
+ Value string `json:"value,omitempty"`
+}
+
+// Validate validates this idp server configuration info
+func (m *IdpServerConfigurationInfo) Validate(formats strfmt.Registry) error {
+ return nil
+}
+
+// ContextValidate validates this idp server configuration info based on context it is used
+func (m *IdpServerConfigurationInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *IdpServerConfigurationInfo) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
+ }
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *IdpServerConfigurationInfo) UnmarshalBinary(b []byte) error {
+ var res IdpServerConfigurationInfo
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
+ return nil
+}
diff --git a/models/set_id_p_response.go b/models/set_id_p_response.go
new file mode 100644
index 0000000000..5a10b63cba
--- /dev/null
+++ b/models/set_id_p_response.go
@@ -0,0 +1,67 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "context"
+
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/swag"
+)
+
+// SetIDPResponse set ID p response
+//
+// swagger:model setIDPResponse
+type SetIDPResponse struct {
+
+ // restart
+ Restart bool `json:"restart,omitempty"`
+}
+
+// Validate validates this set ID p response
+func (m *SetIDPResponse) Validate(formats strfmt.Registry) error {
+ return nil
+}
+
+// ContextValidate validates this set ID p response based on context it is used
+func (m *SetIDPResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+ return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SetIDPResponse) MarshalBinary() ([]byte, error) {
+ if m == nil {
+ return nil, nil
+ }
+ return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SetIDPResponse) UnmarshalBinary(b []byte) error {
+ var res SetIDPResponse
+ if err := swag.ReadJSON(b, &res); err != nil {
+ return err
+ }
+ *m = res
+ return nil
+}
diff --git a/restapi/admin_idp.go b/restapi/admin_idp.go
new file mode 100644
index 0000000000..bef2f8cd5a
--- /dev/null
+++ b/restapi/admin_idp.go
@@ -0,0 +1,210 @@
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package restapi
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/minio/console/models"
+ "github.com/minio/console/restapi/operations"
+ "github.com/minio/console/restapi/operations/idp"
+ madmin "github.com/minio/madmin-go/v2"
+)
+
+var errInvalidIDPType = fmt.Errorf("IDP type must be one of %v", madmin.ValidIDPConfigTypes)
+
+func registerIDPHandlers(api *operations.ConsoleAPI) {
+ api.IdpCreateConfigurationHandler = idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, session *models.Principal) middleware.Responder {
+ response, err := createIDPConfigurationResponse(session, params)
+ if err != nil {
+ return idp.NewCreateConfigurationDefault(int(err.Code)).WithPayload(err)
+ }
+ return idp.NewCreateConfigurationCreated().WithPayload(response)
+ })
+ api.IdpUpdateConfigurationHandler = idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, session *models.Principal) middleware.Responder {
+ response, err := updateIDPConfigurationResponse(session, params)
+ if err != nil {
+ return idp.NewUpdateConfigurationDefault(int(err.Code)).WithPayload(err)
+ }
+ return idp.NewUpdateConfigurationOK().WithPayload(response)
+ })
+ api.IdpListConfigurationsHandler = idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, session *models.Principal) middleware.Responder {
+ response, err := listIDPConfigurationsResponse(session, params)
+ if err != nil {
+ return idp.NewListConfigurationsDefault(int(err.Code)).WithPayload(err)
+ }
+ return idp.NewListConfigurationsOK().WithPayload(response)
+ })
+ api.IdpDeleteConfigurationHandler = idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, session *models.Principal) middleware.Responder {
+ response, err := deleteIDPConfigurationResponse(session, params)
+ if err != nil {
+ return idp.NewDeleteConfigurationDefault(int(err.Code)).WithPayload(err)
+ }
+ return idp.NewDeleteConfigurationOK().WithPayload(response)
+ })
+ api.IdpGetConfigurationHandler = idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, session *models.Principal) middleware.Responder {
+ response, err := getIDPConfigurationsResponse(session, params)
+ if err != nil {
+ return idp.NewGetConfigurationDefault(int(err.Code)).WithPayload(err)
+ }
+ return idp.NewGetConfigurationOK().WithPayload(response)
+ })
+}
+
+func createIDPConfigurationResponse(session *models.Principal, params idp.CreateConfigurationParams) (*models.SetIDPResponse, *models.Error) {
+ ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
+ defer cancel()
+ mAdmin, err := NewMinioAdminClient(session)
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Body.Name, params.Body.Input, false, AdminClient{Client: mAdmin})
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ return &models.SetIDPResponse{Restart: restart}, nil
+}
+
+func updateIDPConfigurationResponse(session *models.Principal, params idp.UpdateConfigurationParams) (*models.SetIDPResponse, *models.Error) {
+ ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
+ defer cancel()
+ mAdmin, err := NewMinioAdminClient(session)
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Name, params.Body.Input, true, AdminClient{Client: mAdmin})
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ return &models.SetIDPResponse{Restart: restart}, nil
+}
+
+func createOrUpdateIDPConfig(ctx context.Context, idpType, name, input string, update bool, client MinioAdmin) (bool, error) {
+ if !madmin.ValidIDPConfigTypes.Contains(idpType) {
+ return false, errInvalidIDPType
+ }
+ restart, err := client.addOrUpdateIDPConfig(ctx, idpType, name, input, update)
+ if err != nil {
+ return false, err
+ }
+ return restart, nil
+}
+
+func listIDPConfigurationsResponse(session *models.Principal, params idp.ListConfigurationsParams) (*models.IdpListConfigurationsResponse, *models.Error) {
+ ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
+ defer cancel()
+ mAdmin, err := NewMinioAdminClient(session)
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ results, err := listIDPConfigurations(ctx, params.Type, AdminClient{Client: mAdmin})
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ return &models.IdpListConfigurationsResponse{Results: results}, nil
+}
+
+func listIDPConfigurations(ctx context.Context, idpType string, client MinioAdmin) ([]*models.IdpServerConfiguration, error) {
+ if !madmin.ValidIDPConfigTypes.Contains(idpType) {
+ return nil, errInvalidIDPType
+ }
+ results, err := client.listIDPConfig(ctx, idpType)
+ if err != nil {
+ return nil, err
+ }
+ return parseIDPConfigurations(results), nil
+}
+
+func parseIDPConfigurations(configs []madmin.IDPListItem) (serverConfigs []*models.IdpServerConfiguration) {
+ for _, c := range configs {
+ serverConfigs = append(serverConfigs, &models.IdpServerConfiguration{
+ Name: c.Name,
+ Enabled: c.Enabled,
+ Type: c.Type,
+ })
+ }
+ return serverConfigs
+}
+
+func deleteIDPConfigurationResponse(session *models.Principal, params idp.DeleteConfigurationParams) (*models.SetIDPResponse, *models.Error) {
+ ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
+ defer cancel()
+ mAdmin, err := NewMinioAdminClient(session)
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ restart, err := deleteIDPConfig(ctx, params.Type, params.Name, AdminClient{Client: mAdmin})
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ return &models.SetIDPResponse{Restart: restart}, nil
+}
+
+func deleteIDPConfig(ctx context.Context, idpType, name string, client MinioAdmin) (bool, error) {
+ if !madmin.ValidIDPConfigTypes.Contains(idpType) {
+ return false, errInvalidIDPType
+ }
+ restart, err := client.deleteIDPConfig(ctx, idpType, name)
+ if err != nil {
+ return false, err
+ }
+ return restart, nil
+}
+
+func getIDPConfigurationsResponse(session *models.Principal, params idp.GetConfigurationParams) (*models.IdpServerConfiguration, *models.Error) {
+ ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
+ defer cancel()
+ mAdmin, err := NewMinioAdminClient(session)
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ result, err := getIDPConfiguration(ctx, params.Type, params.Name, AdminClient{Client: mAdmin})
+ if err != nil {
+ return nil, ErrorWithContext(ctx, err)
+ }
+ return result, nil
+}
+
+func getIDPConfiguration(ctx context.Context, idpType, name string, client MinioAdmin) (*models.IdpServerConfiguration, error) {
+ if !madmin.ValidIDPConfigTypes.Contains(idpType) {
+ return nil, errInvalidIDPType
+ }
+ config, err := client.getIDPConfig(ctx, idpType, name)
+ if err != nil {
+ return nil, err
+ }
+ return &models.IdpServerConfiguration{
+ Name: config.Name,
+ Type: config.Type,
+ Info: parseIDPConfigurationsInfo(config.Info),
+ }, nil
+}
+
+func parseIDPConfigurationsInfo(infoList []madmin.IDPCfgInfo) (results []*models.IdpServerConfigurationInfo) {
+ for _, info := range infoList {
+ results = append(results, &models.IdpServerConfigurationInfo{
+ Key: info.Key,
+ Value: info.Value,
+ IsCfg: info.IsCfg,
+ IsEnv: info.IsEnv,
+ })
+ }
+ return results
+}
diff --git a/restapi/admin_idp_test.go b/restapi/admin_idp_test.go
new file mode 100644
index 0000000000..6630c93540
--- /dev/null
+++ b/restapi/admin_idp_test.go
@@ -0,0 +1,251 @@
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package restapi
+
+import (
+ "context"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "testing"
+
+ "github.com/minio/console/models"
+ "github.com/minio/console/restapi/operations"
+ "github.com/minio/console/restapi/operations/idp"
+ "github.com/minio/madmin-go/v2"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/suite"
+)
+
+func (ac adminClientMock) addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) {
+ return true, nil
+}
+
+func (ac adminClientMock) listIDPConfig(ctx context.Context, idpType string) ([]madmin.IDPListItem, error) {
+ return []madmin.IDPListItem{{Name: "mock"}}, nil
+}
+
+func (ac adminClientMock) deleteIDPConfig(ctx context.Context, idpType, cfgName string) (restart bool, err error) {
+ return true, nil
+}
+
+func (ac adminClientMock) getIDPConfig(ctx context.Context, cfgType, cfgName string) (c madmin.IDPConfig, err error) {
+ return madmin.IDPConfig{Info: []madmin.IDPCfgInfo{{Key: "mock", Value: "mock"}}}, nil
+}
+
+type IDPTestSuite struct {
+ suite.Suite
+ assert *assert.Assertions
+ currentServer string
+ isServerSet bool
+ server *httptest.Server
+ adminClient adminClientMock
+}
+
+func (suite *IDPTestSuite) SetupSuite() {
+ suite.assert = assert.New(suite.T())
+ suite.adminClient = adminClientMock{}
+ minioServiceRestartMock = func(ctx context.Context) error {
+ return nil
+ }
+}
+
+func (suite *IDPTestSuite) SetupTest() {
+ suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler))
+ suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer)
+ os.Setenv(ConsoleMinIOServer, suite.server.URL)
+}
+
+func (suite *IDPTestSuite) serverHandler(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(400)
+}
+
+func (suite *IDPTestSuite) TearDownSuite() {
+}
+
+func (suite *IDPTestSuite) TearDownTest() {
+ if suite.isServerSet {
+ os.Setenv(ConsoleMinIOServer, suite.currentServer)
+ } else {
+ os.Unsetenv(ConsoleMinIOServer)
+ }
+}
+
+func (suite *IDPTestSuite) TestRegisterIDPHandlers() {
+ api := &operations.ConsoleAPI{}
+ suite.assertHandlersAreNil(api)
+ registerIDPHandlers(api)
+ suite.assertHandlersAreNotNil(api)
+}
+
+func (suite *IDPTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) {
+ suite.assert.Nil(api.IdpCreateConfigurationHandler)
+ suite.assert.Nil(api.IdpListConfigurationsHandler)
+ suite.assert.Nil(api.IdpUpdateConfigurationHandler)
+ suite.assert.Nil(api.IdpGetConfigurationHandler)
+ suite.assert.Nil(api.IdpGetConfigurationHandler)
+ suite.assert.Nil(api.IdpDeleteConfigurationHandler)
+}
+
+func (suite *IDPTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) {
+ suite.assert.NotNil(api.IdpCreateConfigurationHandler)
+ suite.assert.NotNil(api.IdpListConfigurationsHandler)
+ suite.assert.NotNil(api.IdpUpdateConfigurationHandler)
+ suite.assert.NotNil(api.IdpGetConfigurationHandler)
+ suite.assert.NotNil(api.IdpGetConfigurationHandler)
+ suite.assert.NotNil(api.IdpDeleteConfigurationHandler)
+}
+
+func (suite *IDPTestSuite) TestCreateIDPConfigurationHandlerWithError() {
+ params, api := suite.initCreateIDPConfigurationRequest()
+ response := api.IdpCreateConfigurationHandler.Handle(params, &models.Principal{})
+ _, ok := response.(*idp.CreateConfigurationDefault)
+ suite.assert.True(ok)
+}
+
+func (suite *IDPTestSuite) initCreateIDPConfigurationRequest() (params idp.CreateConfigurationParams, api operations.ConsoleAPI) {
+ registerIDPHandlers(&api)
+ params.HTTPRequest = &http.Request{}
+ params.Body = &models.IdpServerConfiguration{}
+ params.Type = "ldap"
+ return params, api
+}
+
+func (suite *IDPTestSuite) TestCreateIDPConfigurationWithoutError() {
+ ctx := context.Background()
+ _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", false, suite.adminClient)
+ suite.assert.Nil(err)
+}
+
+func (suite *IDPTestSuite) TestCreateIDPConfigurationWithWrongType() {
+ ctx := context.Background()
+ _, err := createOrUpdateIDPConfig(ctx, "", "", "", false, suite.adminClient)
+ suite.assert.NotNil(err)
+}
+
+func (suite *IDPTestSuite) TestUpdateIDPConfigurationHandlerWithError() {
+ params, api := suite.initUpdateIDPConfigurationRequest()
+ response := api.IdpUpdateConfigurationHandler.Handle(params, &models.Principal{})
+ _, ok := response.(*idp.UpdateConfigurationDefault)
+ suite.assert.True(ok)
+}
+
+func (suite *IDPTestSuite) initUpdateIDPConfigurationRequest() (params idp.UpdateConfigurationParams, api operations.ConsoleAPI) {
+ registerIDPHandlers(&api)
+ params.HTTPRequest = &http.Request{}
+ params.Body = &models.IdpServerConfiguration{}
+ params.Type = "ldap"
+ return params, api
+}
+
+func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithoutError() {
+ ctx := context.Background()
+ _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", true, suite.adminClient)
+ suite.assert.Nil(err)
+}
+
+func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithWrongType() {
+ ctx := context.Background()
+ _, err := createOrUpdateIDPConfig(ctx, "", "", "", true, suite.adminClient)
+ suite.assert.NotNil(err)
+}
+
+func (suite *IDPTestSuite) TestListIDPConfigurationHandlerWithError() {
+ params, api := suite.initListIDPConfigurationsRequest()
+ response := api.IdpListConfigurationsHandler.Handle(params, &models.Principal{})
+ _, ok := response.(*idp.ListConfigurationsDefault)
+ suite.assert.True(ok)
+}
+
+func (suite *IDPTestSuite) initListIDPConfigurationsRequest() (params idp.ListConfigurationsParams, api operations.ConsoleAPI) {
+ registerIDPHandlers(&api)
+ params.HTTPRequest = &http.Request{}
+ params.Type = "ldap"
+ return params, api
+}
+
+func (suite *IDPTestSuite) TestListIDPConfigurationsWithoutError() {
+ ctx := context.Background()
+ res, err := listIDPConfigurations(ctx, "ldap", suite.adminClient)
+ suite.assert.NotNil(res)
+ suite.assert.Nil(err)
+}
+
+func (suite *IDPTestSuite) TestListIDPConfigurationsWithWrongType() {
+ ctx := context.Background()
+ res, err := listIDPConfigurations(ctx, "", suite.adminClient)
+ suite.assert.Nil(res)
+ suite.assert.NotNil(err)
+}
+
+func (suite *IDPTestSuite) TestDeleteIDPConfigurationHandlerWithError() {
+ params, api := suite.initDeleteIDPConfigurationRequest()
+ response := api.IdpDeleteConfigurationHandler.Handle(params, &models.Principal{})
+ _, ok := response.(*idp.DeleteConfigurationDefault)
+ suite.assert.True(ok)
+}
+
+func (suite *IDPTestSuite) initDeleteIDPConfigurationRequest() (params idp.DeleteConfigurationParams, api operations.ConsoleAPI) {
+ registerIDPHandlers(&api)
+ params.HTTPRequest = &http.Request{}
+ params.Type = "ldap"
+ return params, api
+}
+
+func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithoutError() {
+ ctx := context.Background()
+ _, err := deleteIDPConfig(ctx, "ldap", "", suite.adminClient)
+ suite.assert.Nil(err)
+}
+
+func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithWrongType() {
+ ctx := context.Background()
+ _, err := deleteIDPConfig(ctx, "", "", suite.adminClient)
+ suite.assert.NotNil(err)
+}
+
+func (suite *IDPTestSuite) TestGetIDPConfigurationHandlerWithError() {
+ params, api := suite.initGetIDPConfigurationRequest()
+ response := api.IdpGetConfigurationHandler.Handle(params, &models.Principal{})
+ _, ok := response.(*idp.GetConfigurationDefault)
+ suite.assert.True(ok)
+}
+
+func (suite *IDPTestSuite) initGetIDPConfigurationRequest() (params idp.GetConfigurationParams, api operations.ConsoleAPI) {
+ registerIDPHandlers(&api)
+ params.HTTPRequest = &http.Request{}
+ params.Type = "ldap"
+ return params, api
+}
+
+func (suite *IDPTestSuite) TestGetIDPConfigurationWithoutError() {
+ ctx := context.Background()
+ res, err := getIDPConfiguration(ctx, "ldap", "", suite.adminClient)
+ suite.assert.NotNil(res)
+ suite.assert.Nil(err)
+}
+
+func (suite *IDPTestSuite) TestGetIDPConfigurationWithWrongType() {
+ ctx := context.Background()
+ res, err := getIDPConfiguration(ctx, "", "", suite.adminClient)
+ suite.assert.Nil(res)
+ suite.assert.NotNil(err)
+}
+
+func TestIDP(t *testing.T) {
+ suite.Run(t, new(IDPTestSuite))
+}
diff --git a/restapi/client-admin.go b/restapi/client-admin.go
index cab32e77da..4121438e21 100644
--- a/restapi/client-admin.go
+++ b/restapi/client-admin.go
@@ -150,6 +150,12 @@ type MinioAdmin interface {
describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error)
deleteIdentity(ctx context.Context, identity string) error
listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error)
+
+ // IDP
+ addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error)
+ listIDPConfig(ctx context.Context, idpType string) ([]madmin.IDPListItem, error)
+ deleteIDPConfig(ctx context.Context, idpType, cfgName string) (restart bool, err error)
+ getIDPConfig(ctx context.Context, cfgType, cfgName string) (c madmin.IDPConfig, err error)
}
// Interface implementation
@@ -697,3 +703,19 @@ func (ac AdminClient) deleteIdentity(ctx context.Context, identity string) error
func (ac AdminClient) listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) {
return ac.Client.ListIdentities(ctx, pattern)
}
+
+func (ac AdminClient) addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) {
+ return ac.Client.AddOrUpdateIDPConfig(ctx, idpType, cfgName, cfgData, update)
+}
+
+func (ac AdminClient) listIDPConfig(ctx context.Context, idpType string) ([]madmin.IDPListItem, error) {
+ return ac.Client.ListIDPConfig(ctx, idpType)
+}
+
+func (ac AdminClient) deleteIDPConfig(ctx context.Context, idpType, cfgName string) (restart bool, err error) {
+ return ac.Client.DeleteIDPConfig(ctx, idpType, cfgName)
+}
+
+func (ac AdminClient) getIDPConfig(ctx context.Context, idpType, cfgName string) (c madmin.IDPConfig, err error) {
+ return ac.Client.GetIDPConfig(ctx, idpType, cfgName)
+}
diff --git a/restapi/configure_console.go b/restapi/configure_console.go
index 698bfba838..a15d2233c2 100644
--- a/restapi/configure_console.go
+++ b/restapi/configure_console.go
@@ -139,6 +139,8 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
registerSubnetHandlers(api)
// Register admin KMS handlers
registerKMSHandlers(api)
+ // Register admin IDP handlers
+ registerIDPHandlers(api)
// Register Account handlers
registerAdminTiersHandlers(api)
// Register Inspect Handler
diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go
index 8124836164..301a033115 100644
--- a/restapi/embedded_spec.go
+++ b/restapi/embedded_spec.go
@@ -2787,6 +2787,197 @@ func init() {
}
}
},
+ "/idp/{type}": {
+ "get": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "List IDP Configurations",
+ "operationId": "ListConfigurations",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/idpListConfigurationsResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "post": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Create IDP Configuration",
+ "operationId": "CreateConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ }
+ },
+ "/idp/{type}/{name}": {
+ "get": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Get IDP Configuration",
+ "operationId": "GetConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "put": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Update IDP Configuration",
+ "operationId": "UpdateConfiguration",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Delete IDP Configuration",
+ "operationId": "DeleteConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ }
+ },
"/kms/apis": {
"get": {
"tags": [
@@ -5798,6 +5989,57 @@ func init() {
}
}
},
+ "idpListConfigurationsResponse": {
+ "type": "object",
+ "properties": {
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ }
+ }
+ },
+ "idpServerConfiguration": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "info": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/idpServerConfigurationInfo"
+ }
+ },
+ "input": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ }
+ }
+ },
+ "idpServerConfigurationInfo": {
+ "type": "object",
+ "properties": {
+ "isCfg": {
+ "type": "boolean"
+ },
+ "isEnv": {
+ "type": "boolean"
+ },
+ "key": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ },
"kmDeleteKeyRequest": {
"type": "object"
},
@@ -7419,6 +7661,14 @@ func init() {
}
}
},
+ "setIDPResponse": {
+ "type": "object",
+ "properties": {
+ "restart": {
+ "type": "boolean"
+ }
+ }
+ },
"setNotificationEndpointResponse": {
"type": "object",
"required": [
@@ -10969,6 +11219,197 @@ func init() {
}
}
},
+ "/idp/{type}": {
+ "get": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "List IDP Configurations",
+ "operationId": "ListConfigurations",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/idpListConfigurationsResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "post": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Create IDP Configuration",
+ "operationId": "CreateConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ }
+ },
+ "/idp/{type}/{name}": {
+ "get": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Get IDP Configuration",
+ "operationId": "GetConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "put": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Update IDP Configuration",
+ "operationId": "UpdateConfiguration",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "idp"
+ ],
+ "summary": "Delete IDP Configuration",
+ "operationId": "DeleteConfiguration",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "IDP Configuration Name",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "IDP Configuration Type",
+ "name": "type",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/setIDPResponse"
+ }
+ },
+ "default": {
+ "description": "Generic error response.",
+ "schema": {
+ "$ref": "#/definitions/error"
+ }
+ }
+ }
+ }
+ },
"/kms/apis": {
"get": {
"tags": [
@@ -14106,6 +14547,57 @@ func init() {
}
}
},
+ "idpListConfigurationsResponse": {
+ "type": "object",
+ "properties": {
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/idpServerConfiguration"
+ }
+ }
+ }
+ },
+ "idpServerConfiguration": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "info": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/idpServerConfigurationInfo"
+ }
+ },
+ "input": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ }
+ }
+ },
+ "idpServerConfigurationInfo": {
+ "type": "object",
+ "properties": {
+ "isCfg": {
+ "type": "boolean"
+ },
+ "isEnv": {
+ "type": "boolean"
+ },
+ "key": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ },
"kmDeleteKeyRequest": {
"type": "object"
},
@@ -15727,6 +16219,14 @@ func init() {
}
}
},
+ "setIDPResponse": {
+ "type": "object",
+ "properties": {
+ "restart": {
+ "type": "boolean"
+ }
+ }
+ },
"setNotificationEndpointResponse": {
"type": "object",
"required": [
diff --git a/restapi/operations/console_api.go b/restapi/operations/console_api.go
index 0b02b322a5..eaa76d557c 100644
--- a/restapi/operations/console_api.go
+++ b/restapi/operations/console_api.go
@@ -43,6 +43,7 @@ import (
"github.com/minio/console/restapi/operations/bucket"
"github.com/minio/console/restapi/operations/configuration"
"github.com/minio/console/restapi/operations/group"
+ "github.com/minio/console/restapi/operations/idp"
"github.com/minio/console/restapi/operations/inspect"
"github.com/minio/console/restapi/operations/k_m_s"
"github.com/minio/console/restapi/operations/logging"
@@ -145,6 +146,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
BucketCreateBucketEventHandler: bucket.CreateBucketEventHandlerFunc(func(params bucket.CreateBucketEventParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.CreateBucketEvent has not yet been implemented")
}),
+ IdpCreateConfigurationHandler: idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, principal *models.Principal) middleware.Responder {
+ return middleware.NotImplemented("operation idp.CreateConfiguration has not yet been implemented")
+ }),
ServiceAccountCreateServiceAccountHandler: service_account.CreateServiceAccountHandlerFunc(func(params service_account.CreateServiceAccountParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation service_account.CreateServiceAccount has not yet been implemented")
}),
@@ -175,6 +179,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
BucketDeleteBucketReplicationRuleHandler: bucket.DeleteBucketReplicationRuleHandlerFunc(func(params bucket.DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.DeleteBucketReplicationRule has not yet been implemented")
}),
+ IdpDeleteConfigurationHandler: idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, principal *models.Principal) middleware.Responder {
+ return middleware.NotImplemented("operation idp.DeleteConfiguration has not yet been implemented")
+ }),
ObjectDeleteMultipleObjectsHandler: object.DeleteMultipleObjectsHandlerFunc(func(params object.DeleteMultipleObjectsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.DeleteMultipleObjects has not yet been implemented")
}),
@@ -235,6 +242,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
BucketGetBucketVersioningHandler: bucket.GetBucketVersioningHandlerFunc(func(params bucket.GetBucketVersioningParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.GetBucketVersioning has not yet been implemented")
}),
+ IdpGetConfigurationHandler: idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, principal *models.Principal) middleware.Responder {
+ return middleware.NotImplemented("operation idp.GetConfiguration has not yet been implemented")
+ }),
ObjectGetObjectMetadataHandler: object.GetObjectMetadataHandlerFunc(func(params object.GetObjectMetadataParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.GetObjectMetadata has not yet been implemented")
}),
@@ -337,6 +347,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
ConfigurationListConfigHandler: configuration.ListConfigHandlerFunc(func(params configuration.ListConfigParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation configuration.ListConfig has not yet been implemented")
}),
+ IdpListConfigurationsHandler: idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, principal *models.Principal) middleware.Responder {
+ return middleware.NotImplemented("operation idp.ListConfigurations has not yet been implemented")
+ }),
BucketListExternalBucketsHandler: bucket.ListExternalBucketsHandlerFunc(func(params bucket.ListExternalBucketsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.ListExternalBuckets has not yet been implemented")
}),
@@ -505,6 +518,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
BucketUpdateBucketLifecycleHandler: bucket.UpdateBucketLifecycleHandlerFunc(func(params bucket.UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.UpdateBucketLifecycle has not yet been implemented")
}),
+ IdpUpdateConfigurationHandler: idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, principal *models.Principal) middleware.Responder {
+ return middleware.NotImplemented("operation idp.UpdateConfiguration has not yet been implemented")
+ }),
GroupUpdateGroupHandler: group.UpdateGroupHandlerFunc(func(params group.UpdateGroupParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation group.UpdateGroup has not yet been implemented")
}),
@@ -615,6 +631,8 @@ type ConsoleAPI struct {
UserCreateAUserServiceAccountHandler user.CreateAUserServiceAccountHandler
// BucketCreateBucketEventHandler sets the operation handler for the create bucket event operation
BucketCreateBucketEventHandler bucket.CreateBucketEventHandler
+ // IdpCreateConfigurationHandler sets the operation handler for the create configuration operation
+ IdpCreateConfigurationHandler idp.CreateConfigurationHandler
// ServiceAccountCreateServiceAccountHandler sets the operation handler for the create service account operation
ServiceAccountCreateServiceAccountHandler service_account.CreateServiceAccountHandler
// UserCreateServiceAccountCredentialsHandler sets the operation handler for the create service account credentials operation
@@ -635,6 +653,8 @@ type ConsoleAPI struct {
BucketDeleteBucketLifecycleRuleHandler bucket.DeleteBucketLifecycleRuleHandler
// BucketDeleteBucketReplicationRuleHandler sets the operation handler for the delete bucket replication rule operation
BucketDeleteBucketReplicationRuleHandler bucket.DeleteBucketReplicationRuleHandler
+ // IdpDeleteConfigurationHandler sets the operation handler for the delete configuration operation
+ IdpDeleteConfigurationHandler idp.DeleteConfigurationHandler
// ObjectDeleteMultipleObjectsHandler sets the operation handler for the delete multiple objects operation
ObjectDeleteMultipleObjectsHandler object.DeleteMultipleObjectsHandler
// ServiceAccountDeleteMultipleServiceAccountsHandler sets the operation handler for the delete multiple service accounts operation
@@ -675,6 +695,8 @@ type ConsoleAPI struct {
BucketGetBucketRewindHandler bucket.GetBucketRewindHandler
// BucketGetBucketVersioningHandler sets the operation handler for the get bucket versioning operation
BucketGetBucketVersioningHandler bucket.GetBucketVersioningHandler
+ // IdpGetConfigurationHandler sets the operation handler for the get configuration operation
+ IdpGetConfigurationHandler idp.GetConfigurationHandler
// ObjectGetObjectMetadataHandler sets the operation handler for the get object metadata operation
ObjectGetObjectMetadataHandler object.GetObjectMetadataHandler
// PolicyGetSAUserPolicyHandler sets the operation handler for the get s a user policy operation
@@ -743,6 +765,8 @@ type ConsoleAPI struct {
BucketListBucketsHandler bucket.ListBucketsHandler
// ConfigurationListConfigHandler sets the operation handler for the list config operation
ConfigurationListConfigHandler configuration.ListConfigHandler
+ // IdpListConfigurationsHandler sets the operation handler for the list configurations operation
+ IdpListConfigurationsHandler idp.ListConfigurationsHandler
// BucketListExternalBucketsHandler sets the operation handler for the list external buckets operation
BucketListExternalBucketsHandler bucket.ListExternalBucketsHandler
// GroupListGroupsHandler sets the operation handler for the list groups operation
@@ -855,6 +879,8 @@ type ConsoleAPI struct {
TieringTiersListHandler tiering.TiersListHandler
// BucketUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation
BucketUpdateBucketLifecycleHandler bucket.UpdateBucketLifecycleHandler
+ // IdpUpdateConfigurationHandler sets the operation handler for the update configuration operation
+ IdpUpdateConfigurationHandler idp.UpdateConfigurationHandler
// GroupUpdateGroupHandler sets the operation handler for the update group operation
GroupUpdateGroupHandler group.UpdateGroupHandler
// BucketUpdateMultiBucketReplicationHandler sets the operation handler for the update multi bucket replication operation
@@ -1013,6 +1039,9 @@ func (o *ConsoleAPI) Validate() error {
if o.BucketCreateBucketEventHandler == nil {
unregistered = append(unregistered, "bucket.CreateBucketEventHandler")
}
+ if o.IdpCreateConfigurationHandler == nil {
+ unregistered = append(unregistered, "idp.CreateConfigurationHandler")
+ }
if o.ServiceAccountCreateServiceAccountHandler == nil {
unregistered = append(unregistered, "service_account.CreateServiceAccountHandler")
}
@@ -1043,6 +1072,9 @@ func (o *ConsoleAPI) Validate() error {
if o.BucketDeleteBucketReplicationRuleHandler == nil {
unregistered = append(unregistered, "bucket.DeleteBucketReplicationRuleHandler")
}
+ if o.IdpDeleteConfigurationHandler == nil {
+ unregistered = append(unregistered, "idp.DeleteConfigurationHandler")
+ }
if o.ObjectDeleteMultipleObjectsHandler == nil {
unregistered = append(unregistered, "object.DeleteMultipleObjectsHandler")
}
@@ -1103,6 +1135,9 @@ func (o *ConsoleAPI) Validate() error {
if o.BucketGetBucketVersioningHandler == nil {
unregistered = append(unregistered, "bucket.GetBucketVersioningHandler")
}
+ if o.IdpGetConfigurationHandler == nil {
+ unregistered = append(unregistered, "idp.GetConfigurationHandler")
+ }
if o.ObjectGetObjectMetadataHandler == nil {
unregistered = append(unregistered, "object.GetObjectMetadataHandler")
}
@@ -1205,6 +1240,9 @@ func (o *ConsoleAPI) Validate() error {
if o.ConfigurationListConfigHandler == nil {
unregistered = append(unregistered, "configuration.ListConfigHandler")
}
+ if o.IdpListConfigurationsHandler == nil {
+ unregistered = append(unregistered, "idp.ListConfigurationsHandler")
+ }
if o.BucketListExternalBucketsHandler == nil {
unregistered = append(unregistered, "bucket.ListExternalBucketsHandler")
}
@@ -1373,6 +1411,9 @@ func (o *ConsoleAPI) Validate() error {
if o.BucketUpdateBucketLifecycleHandler == nil {
unregistered = append(unregistered, "bucket.UpdateBucketLifecycleHandler")
}
+ if o.IdpUpdateConfigurationHandler == nil {
+ unregistered = append(unregistered, "idp.UpdateConfigurationHandler")
+ }
if o.GroupUpdateGroupHandler == nil {
unregistered = append(unregistered, "group.UpdateGroupHandler")
}
@@ -1572,6 +1613,10 @@ func (o *ConsoleAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
+ o.handlers["POST"]["/idp/{type}"] = idp.NewCreateConfiguration(o.context, o.IdpCreateConfigurationHandler)
+ if o.handlers["POST"] == nil {
+ o.handlers["POST"] = make(map[string]http.Handler)
+ }
o.handlers["POST"]["/service-accounts"] = service_account.NewCreateServiceAccount(o.context, o.ServiceAccountCreateServiceAccountHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
@@ -1609,6 +1654,10 @@ func (o *ConsoleAPI) initHandlerCache() {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewDeleteBucketReplicationRule(o.context, o.BucketDeleteBucketReplicationRuleHandler)
+ if o.handlers["DELETE"] == nil {
+ o.handlers["DELETE"] = make(map[string]http.Handler)
+ }
+ o.handlers["DELETE"]["/idp/{type}/{name}"] = idp.NewDeleteConfiguration(o.context, o.IdpDeleteConfigurationHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
@@ -1692,6 +1741,10 @@ func (o *ConsoleAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
+ o.handlers["GET"]["/idp/{type}/{name}"] = idp.NewGetConfiguration(o.context, o.IdpGetConfigurationHandler)
+ if o.handlers["GET"] == nil {
+ o.handlers["GET"] = make(map[string]http.Handler)
+ }
o.handlers["GET"]["/buckets/{bucket_name}/objects/metadata"] = object.NewGetObjectMetadata(o.context, o.ObjectGetObjectMetadataHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
@@ -1825,6 +1878,10 @@ func (o *ConsoleAPI) initHandlerCache() {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/configs"] = configuration.NewListConfig(o.context, o.ConfigurationListConfigHandler)
+ if o.handlers["GET"] == nil {
+ o.handlers["GET"] = make(map[string]http.Handler)
+ }
+ o.handlers["GET"]["/idp/{type}"] = idp.NewListConfigurations(o.context, o.IdpListConfigurationsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
@@ -2052,6 +2109,10 @@ func (o *ConsoleAPI) initHandlerCache() {
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
+ o.handlers["PUT"]["/idp/{type}/{name}"] = idp.NewUpdateConfiguration(o.context, o.IdpUpdateConfigurationHandler)
+ if o.handlers["PUT"] == nil {
+ o.handlers["PUT"] = make(map[string]http.Handler)
+ }
o.handlers["PUT"]["/group/{name}"] = group.NewUpdateGroup(o.context, o.GroupUpdateGroupHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
diff --git a/restapi/operations/idp/create_configuration.go b/restapi/operations/idp/create_configuration.go
new file mode 100644
index 0000000000..67cc140734
--- /dev/null
+++ b/restapi/operations/idp/create_configuration.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime/middleware"
+
+ "github.com/minio/console/models"
+)
+
+// CreateConfigurationHandlerFunc turns a function with the right signature into a create configuration handler
+type CreateConfigurationHandlerFunc func(CreateConfigurationParams, *models.Principal) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn CreateConfigurationHandlerFunc) Handle(params CreateConfigurationParams, principal *models.Principal) middleware.Responder {
+ return fn(params, principal)
+}
+
+// CreateConfigurationHandler interface for that can handle valid create configuration params
+type CreateConfigurationHandler interface {
+ Handle(CreateConfigurationParams, *models.Principal) middleware.Responder
+}
+
+// NewCreateConfiguration creates a new http.Handler for the create configuration operation
+func NewCreateConfiguration(ctx *middleware.Context, handler CreateConfigurationHandler) *CreateConfiguration {
+ return &CreateConfiguration{Context: ctx, Handler: handler}
+}
+
+/*
+ CreateConfiguration swagger:route POST /idp/{type} idp createConfiguration
+
+Create IDP Configuration
+*/
+type CreateConfiguration struct {
+ Context *middleware.Context
+ Handler CreateConfigurationHandler
+}
+
+func (o *CreateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+ route, rCtx, _ := o.Context.RouteInfo(r)
+ if rCtx != nil {
+ *r = *rCtx
+ }
+ var Params = NewCreateConfigurationParams()
+ uprinc, aCtx, err := o.Context.Authorize(r, route)
+ if err != nil {
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+ if aCtx != nil {
+ *r = *aCtx
+ }
+ var principal *models.Principal
+ if uprinc != nil {
+ principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
+ }
+
+ if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+
+ res := o.Handler.Handle(Params, principal) // actually handle the request
+ o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/restapi/operations/idp/create_configuration_parameters.go b/restapi/operations/idp/create_configuration_parameters.go
new file mode 100644
index 0000000000..9e1d5ae1a5
--- /dev/null
+++ b/restapi/operations/idp/create_configuration_parameters.go
@@ -0,0 +1,126 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "io"
+ "net/http"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/runtime"
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/validate"
+
+ "github.com/minio/console/models"
+)
+
+// NewCreateConfigurationParams creates a new CreateConfigurationParams object
+//
+// There are no default values defined in the spec.
+func NewCreateConfigurationParams() CreateConfigurationParams {
+
+ return CreateConfigurationParams{}
+}
+
+// CreateConfigurationParams contains all the bound params for the create configuration operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters CreateConfiguration
+type CreateConfigurationParams struct {
+
+ // HTTP Request Object
+ HTTPRequest *http.Request `json:"-"`
+
+ /*
+ Required: true
+ In: body
+ */
+ Body *models.IdpServerConfiguration
+ /*IDP Configuration Type
+ Required: true
+ In: path
+ */
+ Type string
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewCreateConfigurationParams() beforehand.
+func (o *CreateConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+ var res []error
+
+ o.HTTPRequest = r
+
+ if runtime.HasBody(r) {
+ defer r.Body.Close()
+ var body models.IdpServerConfiguration
+ if err := route.Consumer.Consume(r.Body, &body); err != nil {
+ if err == io.EOF {
+ res = append(res, errors.Required("body", "body", ""))
+ } else {
+ res = append(res, errors.NewParseError("body", "body", "", err))
+ }
+ } else {
+ // validate body object
+ if err := body.Validate(route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ ctx := validate.WithOperationRequest(r.Context())
+ if err := body.ContextValidate(ctx, route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) == 0 {
+ o.Body = &body
+ }
+ }
+ } else {
+ res = append(res, errors.Required("body", "body", ""))
+ }
+
+ rType, rhkType, _ := route.Params.GetOK("type")
+ if err := o.bindType(rType, rhkType, route.Formats); err != nil {
+ res = append(res, err)
+ }
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+// bindType binds and validates parameter Type from path.
+func (o *CreateConfigurationParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Type = raw
+
+ return nil
+}
diff --git a/restapi/operations/idp/create_configuration_responses.go b/restapi/operations/idp/create_configuration_responses.go
new file mode 100644
index 0000000000..209d639007
--- /dev/null
+++ b/restapi/operations/idp/create_configuration_responses.go
@@ -0,0 +1,135 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime"
+
+ "github.com/minio/console/models"
+)
+
+// CreateConfigurationCreatedCode is the HTTP code returned for type CreateConfigurationCreated
+const CreateConfigurationCreatedCode int = 201
+
+/*
+CreateConfigurationCreated A successful response.
+
+swagger:response createConfigurationCreated
+*/
+type CreateConfigurationCreated struct {
+
+ /*
+ In: Body
+ */
+ Payload *models.SetIDPResponse `json:"body,omitempty"`
+}
+
+// NewCreateConfigurationCreated creates CreateConfigurationCreated with default headers values
+func NewCreateConfigurationCreated() *CreateConfigurationCreated {
+
+ return &CreateConfigurationCreated{}
+}
+
+// WithPayload adds the payload to the create configuration created response
+func (o *CreateConfigurationCreated) WithPayload(payload *models.SetIDPResponse) *CreateConfigurationCreated {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the create configuration created response
+func (o *CreateConfigurationCreated) SetPayload(payload *models.SetIDPResponse) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *CreateConfigurationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(201)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
+
+/*
+CreateConfigurationDefault Generic error response.
+
+swagger:response createConfigurationDefault
+*/
+type CreateConfigurationDefault struct {
+ _statusCode int
+
+ /*
+ In: Body
+ */
+ Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewCreateConfigurationDefault creates CreateConfigurationDefault with default headers values
+func NewCreateConfigurationDefault(code int) *CreateConfigurationDefault {
+ if code <= 0 {
+ code = 500
+ }
+
+ return &CreateConfigurationDefault{
+ _statusCode: code,
+ }
+}
+
+// WithStatusCode adds the status to the create configuration default response
+func (o *CreateConfigurationDefault) WithStatusCode(code int) *CreateConfigurationDefault {
+ o._statusCode = code
+ return o
+}
+
+// SetStatusCode sets the status to the create configuration default response
+func (o *CreateConfigurationDefault) SetStatusCode(code int) {
+ o._statusCode = code
+}
+
+// WithPayload adds the payload to the create configuration default response
+func (o *CreateConfigurationDefault) WithPayload(payload *models.Error) *CreateConfigurationDefault {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the create configuration default response
+func (o *CreateConfigurationDefault) SetPayload(payload *models.Error) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *CreateConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(o._statusCode)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
diff --git a/restapi/operations/idp/create_configuration_urlbuilder.go b/restapi/operations/idp/create_configuration_urlbuilder.go
new file mode 100644
index 0000000000..58ee2ff5f7
--- /dev/null
+++ b/restapi/operations/idp/create_configuration_urlbuilder.go
@@ -0,0 +1,116 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "errors"
+ "net/url"
+ golangswaggerpaths "path"
+ "strings"
+)
+
+// CreateConfigurationURL generates an URL for the create configuration operation
+type CreateConfigurationURL struct {
+ Type string
+
+ _basePath string
+ // avoid unkeyed usage
+ _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *CreateConfigurationURL) WithBasePath(bp string) *CreateConfigurationURL {
+ o.SetBasePath(bp)
+ return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *CreateConfigurationURL) SetBasePath(bp string) {
+ o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *CreateConfigurationURL) Build() (*url.URL, error) {
+ var _result url.URL
+
+ var _path = "/idp/{type}"
+
+ typeVar := o.Type
+ if typeVar != "" {
+ _path = strings.Replace(_path, "{type}", typeVar, -1)
+ } else {
+ return nil, errors.New("type is required on CreateConfigurationURL")
+ }
+
+ _basePath := o._basePath
+ if _basePath == "" {
+ _basePath = "/api/v1"
+ }
+ _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+ return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *CreateConfigurationURL) Must(u *url.URL, err error) *url.URL {
+ if err != nil {
+ panic(err)
+ }
+ if u == nil {
+ panic("url can't be nil")
+ }
+ return u
+}
+
+// String returns the string representation of the path with query string
+func (o *CreateConfigurationURL) String() string {
+ return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *CreateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) {
+ if scheme == "" {
+ return nil, errors.New("scheme is required for a full url on CreateConfigurationURL")
+ }
+ if host == "" {
+ return nil, errors.New("host is required for a full url on CreateConfigurationURL")
+ }
+
+ base, err := o.Build()
+ if err != nil {
+ return nil, err
+ }
+
+ base.Scheme = scheme
+ base.Host = host
+ return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *CreateConfigurationURL) StringFull(scheme, host string) string {
+ return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/restapi/operations/idp/delete_configuration.go b/restapi/operations/idp/delete_configuration.go
new file mode 100644
index 0000000000..1c7e2cdc33
--- /dev/null
+++ b/restapi/operations/idp/delete_configuration.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime/middleware"
+
+ "github.com/minio/console/models"
+)
+
+// DeleteConfigurationHandlerFunc turns a function with the right signature into a delete configuration handler
+type DeleteConfigurationHandlerFunc func(DeleteConfigurationParams, *models.Principal) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn DeleteConfigurationHandlerFunc) Handle(params DeleteConfigurationParams, principal *models.Principal) middleware.Responder {
+ return fn(params, principal)
+}
+
+// DeleteConfigurationHandler interface for that can handle valid delete configuration params
+type DeleteConfigurationHandler interface {
+ Handle(DeleteConfigurationParams, *models.Principal) middleware.Responder
+}
+
+// NewDeleteConfiguration creates a new http.Handler for the delete configuration operation
+func NewDeleteConfiguration(ctx *middleware.Context, handler DeleteConfigurationHandler) *DeleteConfiguration {
+ return &DeleteConfiguration{Context: ctx, Handler: handler}
+}
+
+/*
+ DeleteConfiguration swagger:route DELETE /idp/{type}/{name} idp deleteConfiguration
+
+Delete IDP Configuration
+*/
+type DeleteConfiguration struct {
+ Context *middleware.Context
+ Handler DeleteConfigurationHandler
+}
+
+func (o *DeleteConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+ route, rCtx, _ := o.Context.RouteInfo(r)
+ if rCtx != nil {
+ *r = *rCtx
+ }
+ var Params = NewDeleteConfigurationParams()
+ uprinc, aCtx, err := o.Context.Authorize(r, route)
+ if err != nil {
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+ if aCtx != nil {
+ *r = *aCtx
+ }
+ var principal *models.Principal
+ if uprinc != nil {
+ principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
+ }
+
+ if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+
+ res := o.Handler.Handle(Params, principal) // actually handle the request
+ o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/restapi/operations/idp/delete_configuration_parameters.go b/restapi/operations/idp/delete_configuration_parameters.go
new file mode 100644
index 0000000000..4b15838569
--- /dev/null
+++ b/restapi/operations/idp/delete_configuration_parameters.go
@@ -0,0 +1,112 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/go-openapi/strfmt"
+)
+
+// NewDeleteConfigurationParams creates a new DeleteConfigurationParams object
+//
+// There are no default values defined in the spec.
+func NewDeleteConfigurationParams() DeleteConfigurationParams {
+
+ return DeleteConfigurationParams{}
+}
+
+// DeleteConfigurationParams contains all the bound params for the delete configuration operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters DeleteConfiguration
+type DeleteConfigurationParams struct {
+
+ // HTTP Request Object
+ HTTPRequest *http.Request `json:"-"`
+
+ /*IDP Configuration Name
+ Required: true
+ In: path
+ */
+ Name string
+ /*IDP Configuration Type
+ Required: true
+ In: path
+ */
+ Type string
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewDeleteConfigurationParams() beforehand.
+func (o *DeleteConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+ var res []error
+
+ o.HTTPRequest = r
+
+ rName, rhkName, _ := route.Params.GetOK("name")
+ if err := o.bindName(rName, rhkName, route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ rType, rhkType, _ := route.Params.GetOK("type")
+ if err := o.bindType(rType, rhkType, route.Formats); err != nil {
+ res = append(res, err)
+ }
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+// bindName binds and validates parameter Name from path.
+func (o *DeleteConfigurationParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Name = raw
+
+ return nil
+}
+
+// bindType binds and validates parameter Type from path.
+func (o *DeleteConfigurationParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Type = raw
+
+ return nil
+}
diff --git a/restapi/operations/idp/delete_configuration_responses.go b/restapi/operations/idp/delete_configuration_responses.go
new file mode 100644
index 0000000000..b7f084356e
--- /dev/null
+++ b/restapi/operations/idp/delete_configuration_responses.go
@@ -0,0 +1,135 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime"
+
+ "github.com/minio/console/models"
+)
+
+// DeleteConfigurationOKCode is the HTTP code returned for type DeleteConfigurationOK
+const DeleteConfigurationOKCode int = 200
+
+/*
+DeleteConfigurationOK A successful response.
+
+swagger:response deleteConfigurationOK
+*/
+type DeleteConfigurationOK struct {
+
+ /*
+ In: Body
+ */
+ Payload *models.SetIDPResponse `json:"body,omitempty"`
+}
+
+// NewDeleteConfigurationOK creates DeleteConfigurationOK with default headers values
+func NewDeleteConfigurationOK() *DeleteConfigurationOK {
+
+ return &DeleteConfigurationOK{}
+}
+
+// WithPayload adds the payload to the delete configuration o k response
+func (o *DeleteConfigurationOK) WithPayload(payload *models.SetIDPResponse) *DeleteConfigurationOK {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the delete configuration o k response
+func (o *DeleteConfigurationOK) SetPayload(payload *models.SetIDPResponse) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *DeleteConfigurationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(200)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
+
+/*
+DeleteConfigurationDefault Generic error response.
+
+swagger:response deleteConfigurationDefault
+*/
+type DeleteConfigurationDefault struct {
+ _statusCode int
+
+ /*
+ In: Body
+ */
+ Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewDeleteConfigurationDefault creates DeleteConfigurationDefault with default headers values
+func NewDeleteConfigurationDefault(code int) *DeleteConfigurationDefault {
+ if code <= 0 {
+ code = 500
+ }
+
+ return &DeleteConfigurationDefault{
+ _statusCode: code,
+ }
+}
+
+// WithStatusCode adds the status to the delete configuration default response
+func (o *DeleteConfigurationDefault) WithStatusCode(code int) *DeleteConfigurationDefault {
+ o._statusCode = code
+ return o
+}
+
+// SetStatusCode sets the status to the delete configuration default response
+func (o *DeleteConfigurationDefault) SetStatusCode(code int) {
+ o._statusCode = code
+}
+
+// WithPayload adds the payload to the delete configuration default response
+func (o *DeleteConfigurationDefault) WithPayload(payload *models.Error) *DeleteConfigurationDefault {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the delete configuration default response
+func (o *DeleteConfigurationDefault) SetPayload(payload *models.Error) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *DeleteConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(o._statusCode)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
diff --git a/restapi/operations/idp/delete_configuration_urlbuilder.go b/restapi/operations/idp/delete_configuration_urlbuilder.go
new file mode 100644
index 0000000000..e5652a0222
--- /dev/null
+++ b/restapi/operations/idp/delete_configuration_urlbuilder.go
@@ -0,0 +1,124 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "errors"
+ "net/url"
+ golangswaggerpaths "path"
+ "strings"
+)
+
+// DeleteConfigurationURL generates an URL for the delete configuration operation
+type DeleteConfigurationURL struct {
+ Name string
+ Type string
+
+ _basePath string
+ // avoid unkeyed usage
+ _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *DeleteConfigurationURL) WithBasePath(bp string) *DeleteConfigurationURL {
+ o.SetBasePath(bp)
+ return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *DeleteConfigurationURL) SetBasePath(bp string) {
+ o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *DeleteConfigurationURL) Build() (*url.URL, error) {
+ var _result url.URL
+
+ var _path = "/idp/{type}/{name}"
+
+ name := o.Name
+ if name != "" {
+ _path = strings.Replace(_path, "{name}", name, -1)
+ } else {
+ return nil, errors.New("name is required on DeleteConfigurationURL")
+ }
+
+ typeVar := o.Type
+ if typeVar != "" {
+ _path = strings.Replace(_path, "{type}", typeVar, -1)
+ } else {
+ return nil, errors.New("type is required on DeleteConfigurationURL")
+ }
+
+ _basePath := o._basePath
+ if _basePath == "" {
+ _basePath = "/api/v1"
+ }
+ _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+ return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *DeleteConfigurationURL) Must(u *url.URL, err error) *url.URL {
+ if err != nil {
+ panic(err)
+ }
+ if u == nil {
+ panic("url can't be nil")
+ }
+ return u
+}
+
+// String returns the string representation of the path with query string
+func (o *DeleteConfigurationURL) String() string {
+ return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *DeleteConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) {
+ if scheme == "" {
+ return nil, errors.New("scheme is required for a full url on DeleteConfigurationURL")
+ }
+ if host == "" {
+ return nil, errors.New("host is required for a full url on DeleteConfigurationURL")
+ }
+
+ base, err := o.Build()
+ if err != nil {
+ return nil, err
+ }
+
+ base.Scheme = scheme
+ base.Host = host
+ return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *DeleteConfigurationURL) StringFull(scheme, host string) string {
+ return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/restapi/operations/idp/get_configuration.go b/restapi/operations/idp/get_configuration.go
new file mode 100644
index 0000000000..0eb5e6bf07
--- /dev/null
+++ b/restapi/operations/idp/get_configuration.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime/middleware"
+
+ "github.com/minio/console/models"
+)
+
+// GetConfigurationHandlerFunc turns a function with the right signature into a get configuration handler
+type GetConfigurationHandlerFunc func(GetConfigurationParams, *models.Principal) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn GetConfigurationHandlerFunc) Handle(params GetConfigurationParams, principal *models.Principal) middleware.Responder {
+ return fn(params, principal)
+}
+
+// GetConfigurationHandler interface for that can handle valid get configuration params
+type GetConfigurationHandler interface {
+ Handle(GetConfigurationParams, *models.Principal) middleware.Responder
+}
+
+// NewGetConfiguration creates a new http.Handler for the get configuration operation
+func NewGetConfiguration(ctx *middleware.Context, handler GetConfigurationHandler) *GetConfiguration {
+ return &GetConfiguration{Context: ctx, Handler: handler}
+}
+
+/*
+ GetConfiguration swagger:route GET /idp/{type}/{name} idp getConfiguration
+
+Get IDP Configuration
+*/
+type GetConfiguration struct {
+ Context *middleware.Context
+ Handler GetConfigurationHandler
+}
+
+func (o *GetConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+ route, rCtx, _ := o.Context.RouteInfo(r)
+ if rCtx != nil {
+ *r = *rCtx
+ }
+ var Params = NewGetConfigurationParams()
+ uprinc, aCtx, err := o.Context.Authorize(r, route)
+ if err != nil {
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+ if aCtx != nil {
+ *r = *aCtx
+ }
+ var principal *models.Principal
+ if uprinc != nil {
+ principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
+ }
+
+ if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+
+ res := o.Handler.Handle(Params, principal) // actually handle the request
+ o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/restapi/operations/idp/get_configuration_parameters.go b/restapi/operations/idp/get_configuration_parameters.go
new file mode 100644
index 0000000000..d6f05d37e0
--- /dev/null
+++ b/restapi/operations/idp/get_configuration_parameters.go
@@ -0,0 +1,112 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/go-openapi/strfmt"
+)
+
+// NewGetConfigurationParams creates a new GetConfigurationParams object
+//
+// There are no default values defined in the spec.
+func NewGetConfigurationParams() GetConfigurationParams {
+
+ return GetConfigurationParams{}
+}
+
+// GetConfigurationParams contains all the bound params for the get configuration operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters GetConfiguration
+type GetConfigurationParams struct {
+
+ // HTTP Request Object
+ HTTPRequest *http.Request `json:"-"`
+
+ /*IDP Configuration Name
+ Required: true
+ In: path
+ */
+ Name string
+ /*IDP Configuration Type
+ Required: true
+ In: path
+ */
+ Type string
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewGetConfigurationParams() beforehand.
+func (o *GetConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+ var res []error
+
+ o.HTTPRequest = r
+
+ rName, rhkName, _ := route.Params.GetOK("name")
+ if err := o.bindName(rName, rhkName, route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ rType, rhkType, _ := route.Params.GetOK("type")
+ if err := o.bindType(rType, rhkType, route.Formats); err != nil {
+ res = append(res, err)
+ }
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+// bindName binds and validates parameter Name from path.
+func (o *GetConfigurationParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Name = raw
+
+ return nil
+}
+
+// bindType binds and validates parameter Type from path.
+func (o *GetConfigurationParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Type = raw
+
+ return nil
+}
diff --git a/restapi/operations/idp/get_configuration_responses.go b/restapi/operations/idp/get_configuration_responses.go
new file mode 100644
index 0000000000..8abade7bcc
--- /dev/null
+++ b/restapi/operations/idp/get_configuration_responses.go
@@ -0,0 +1,135 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime"
+
+ "github.com/minio/console/models"
+)
+
+// GetConfigurationOKCode is the HTTP code returned for type GetConfigurationOK
+const GetConfigurationOKCode int = 200
+
+/*
+GetConfigurationOK A successful response.
+
+swagger:response getConfigurationOK
+*/
+type GetConfigurationOK struct {
+
+ /*
+ In: Body
+ */
+ Payload *models.IdpServerConfiguration `json:"body,omitempty"`
+}
+
+// NewGetConfigurationOK creates GetConfigurationOK with default headers values
+func NewGetConfigurationOK() *GetConfigurationOK {
+
+ return &GetConfigurationOK{}
+}
+
+// WithPayload adds the payload to the get configuration o k response
+func (o *GetConfigurationOK) WithPayload(payload *models.IdpServerConfiguration) *GetConfigurationOK {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the get configuration o k response
+func (o *GetConfigurationOK) SetPayload(payload *models.IdpServerConfiguration) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *GetConfigurationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(200)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
+
+/*
+GetConfigurationDefault Generic error response.
+
+swagger:response getConfigurationDefault
+*/
+type GetConfigurationDefault struct {
+ _statusCode int
+
+ /*
+ In: Body
+ */
+ Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewGetConfigurationDefault creates GetConfigurationDefault with default headers values
+func NewGetConfigurationDefault(code int) *GetConfigurationDefault {
+ if code <= 0 {
+ code = 500
+ }
+
+ return &GetConfigurationDefault{
+ _statusCode: code,
+ }
+}
+
+// WithStatusCode adds the status to the get configuration default response
+func (o *GetConfigurationDefault) WithStatusCode(code int) *GetConfigurationDefault {
+ o._statusCode = code
+ return o
+}
+
+// SetStatusCode sets the status to the get configuration default response
+func (o *GetConfigurationDefault) SetStatusCode(code int) {
+ o._statusCode = code
+}
+
+// WithPayload adds the payload to the get configuration default response
+func (o *GetConfigurationDefault) WithPayload(payload *models.Error) *GetConfigurationDefault {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the get configuration default response
+func (o *GetConfigurationDefault) SetPayload(payload *models.Error) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *GetConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(o._statusCode)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
diff --git a/restapi/operations/idp/get_configuration_urlbuilder.go b/restapi/operations/idp/get_configuration_urlbuilder.go
new file mode 100644
index 0000000000..f7be10865c
--- /dev/null
+++ b/restapi/operations/idp/get_configuration_urlbuilder.go
@@ -0,0 +1,124 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "errors"
+ "net/url"
+ golangswaggerpaths "path"
+ "strings"
+)
+
+// GetConfigurationURL generates an URL for the get configuration operation
+type GetConfigurationURL struct {
+ Name string
+ Type string
+
+ _basePath string
+ // avoid unkeyed usage
+ _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *GetConfigurationURL) WithBasePath(bp string) *GetConfigurationURL {
+ o.SetBasePath(bp)
+ return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *GetConfigurationURL) SetBasePath(bp string) {
+ o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *GetConfigurationURL) Build() (*url.URL, error) {
+ var _result url.URL
+
+ var _path = "/idp/{type}/{name}"
+
+ name := o.Name
+ if name != "" {
+ _path = strings.Replace(_path, "{name}", name, -1)
+ } else {
+ return nil, errors.New("name is required on GetConfigurationURL")
+ }
+
+ typeVar := o.Type
+ if typeVar != "" {
+ _path = strings.Replace(_path, "{type}", typeVar, -1)
+ } else {
+ return nil, errors.New("type is required on GetConfigurationURL")
+ }
+
+ _basePath := o._basePath
+ if _basePath == "" {
+ _basePath = "/api/v1"
+ }
+ _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+ return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *GetConfigurationURL) Must(u *url.URL, err error) *url.URL {
+ if err != nil {
+ panic(err)
+ }
+ if u == nil {
+ panic("url can't be nil")
+ }
+ return u
+}
+
+// String returns the string representation of the path with query string
+func (o *GetConfigurationURL) String() string {
+ return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *GetConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) {
+ if scheme == "" {
+ return nil, errors.New("scheme is required for a full url on GetConfigurationURL")
+ }
+ if host == "" {
+ return nil, errors.New("host is required for a full url on GetConfigurationURL")
+ }
+
+ base, err := o.Build()
+ if err != nil {
+ return nil, err
+ }
+
+ base.Scheme = scheme
+ base.Host = host
+ return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *GetConfigurationURL) StringFull(scheme, host string) string {
+ return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/restapi/operations/idp/list_configurations.go b/restapi/operations/idp/list_configurations.go
new file mode 100644
index 0000000000..269b99c58b
--- /dev/null
+++ b/restapi/operations/idp/list_configurations.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime/middleware"
+
+ "github.com/minio/console/models"
+)
+
+// ListConfigurationsHandlerFunc turns a function with the right signature into a list configurations handler
+type ListConfigurationsHandlerFunc func(ListConfigurationsParams, *models.Principal) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn ListConfigurationsHandlerFunc) Handle(params ListConfigurationsParams, principal *models.Principal) middleware.Responder {
+ return fn(params, principal)
+}
+
+// ListConfigurationsHandler interface for that can handle valid list configurations params
+type ListConfigurationsHandler interface {
+ Handle(ListConfigurationsParams, *models.Principal) middleware.Responder
+}
+
+// NewListConfigurations creates a new http.Handler for the list configurations operation
+func NewListConfigurations(ctx *middleware.Context, handler ListConfigurationsHandler) *ListConfigurations {
+ return &ListConfigurations{Context: ctx, Handler: handler}
+}
+
+/*
+ ListConfigurations swagger:route GET /idp/{type} idp listConfigurations
+
+List IDP Configurations
+*/
+type ListConfigurations struct {
+ Context *middleware.Context
+ Handler ListConfigurationsHandler
+}
+
+func (o *ListConfigurations) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+ route, rCtx, _ := o.Context.RouteInfo(r)
+ if rCtx != nil {
+ *r = *rCtx
+ }
+ var Params = NewListConfigurationsParams()
+ uprinc, aCtx, err := o.Context.Authorize(r, route)
+ if err != nil {
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+ if aCtx != nil {
+ *r = *aCtx
+ }
+ var principal *models.Principal
+ if uprinc != nil {
+ principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
+ }
+
+ if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+
+ res := o.Handler.Handle(Params, principal) // actually handle the request
+ o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/restapi/operations/idp/list_configurations_parameters.go b/restapi/operations/idp/list_configurations_parameters.go
new file mode 100644
index 0000000000..81a6eb8d8a
--- /dev/null
+++ b/restapi/operations/idp/list_configurations_parameters.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/go-openapi/strfmt"
+)
+
+// NewListConfigurationsParams creates a new ListConfigurationsParams object
+//
+// There are no default values defined in the spec.
+func NewListConfigurationsParams() ListConfigurationsParams {
+
+ return ListConfigurationsParams{}
+}
+
+// ListConfigurationsParams contains all the bound params for the list configurations operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters ListConfigurations
+type ListConfigurationsParams struct {
+
+ // HTTP Request Object
+ HTTPRequest *http.Request `json:"-"`
+
+ /*IDP Configuration Type
+ Required: true
+ In: path
+ */
+ Type string
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewListConfigurationsParams() beforehand.
+func (o *ListConfigurationsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+ var res []error
+
+ o.HTTPRequest = r
+
+ rType, rhkType, _ := route.Params.GetOK("type")
+ if err := o.bindType(rType, rhkType, route.Formats); err != nil {
+ res = append(res, err)
+ }
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+// bindType binds and validates parameter Type from path.
+func (o *ListConfigurationsParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Type = raw
+
+ return nil
+}
diff --git a/restapi/operations/idp/list_configurations_responses.go b/restapi/operations/idp/list_configurations_responses.go
new file mode 100644
index 0000000000..cb94c577e2
--- /dev/null
+++ b/restapi/operations/idp/list_configurations_responses.go
@@ -0,0 +1,135 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime"
+
+ "github.com/minio/console/models"
+)
+
+// ListConfigurationsOKCode is the HTTP code returned for type ListConfigurationsOK
+const ListConfigurationsOKCode int = 200
+
+/*
+ListConfigurationsOK A successful response.
+
+swagger:response listConfigurationsOK
+*/
+type ListConfigurationsOK struct {
+
+ /*
+ In: Body
+ */
+ Payload *models.IdpListConfigurationsResponse `json:"body,omitempty"`
+}
+
+// NewListConfigurationsOK creates ListConfigurationsOK with default headers values
+func NewListConfigurationsOK() *ListConfigurationsOK {
+
+ return &ListConfigurationsOK{}
+}
+
+// WithPayload adds the payload to the list configurations o k response
+func (o *ListConfigurationsOK) WithPayload(payload *models.IdpListConfigurationsResponse) *ListConfigurationsOK {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the list configurations o k response
+func (o *ListConfigurationsOK) SetPayload(payload *models.IdpListConfigurationsResponse) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *ListConfigurationsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(200)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
+
+/*
+ListConfigurationsDefault Generic error response.
+
+swagger:response listConfigurationsDefault
+*/
+type ListConfigurationsDefault struct {
+ _statusCode int
+
+ /*
+ In: Body
+ */
+ Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewListConfigurationsDefault creates ListConfigurationsDefault with default headers values
+func NewListConfigurationsDefault(code int) *ListConfigurationsDefault {
+ if code <= 0 {
+ code = 500
+ }
+
+ return &ListConfigurationsDefault{
+ _statusCode: code,
+ }
+}
+
+// WithStatusCode adds the status to the list configurations default response
+func (o *ListConfigurationsDefault) WithStatusCode(code int) *ListConfigurationsDefault {
+ o._statusCode = code
+ return o
+}
+
+// SetStatusCode sets the status to the list configurations default response
+func (o *ListConfigurationsDefault) SetStatusCode(code int) {
+ o._statusCode = code
+}
+
+// WithPayload adds the payload to the list configurations default response
+func (o *ListConfigurationsDefault) WithPayload(payload *models.Error) *ListConfigurationsDefault {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the list configurations default response
+func (o *ListConfigurationsDefault) SetPayload(payload *models.Error) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *ListConfigurationsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(o._statusCode)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
diff --git a/restapi/operations/idp/list_configurations_urlbuilder.go b/restapi/operations/idp/list_configurations_urlbuilder.go
new file mode 100644
index 0000000000..eda02c85ae
--- /dev/null
+++ b/restapi/operations/idp/list_configurations_urlbuilder.go
@@ -0,0 +1,116 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "errors"
+ "net/url"
+ golangswaggerpaths "path"
+ "strings"
+)
+
+// ListConfigurationsURL generates an URL for the list configurations operation
+type ListConfigurationsURL struct {
+ Type string
+
+ _basePath string
+ // avoid unkeyed usage
+ _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *ListConfigurationsURL) WithBasePath(bp string) *ListConfigurationsURL {
+ o.SetBasePath(bp)
+ return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *ListConfigurationsURL) SetBasePath(bp string) {
+ o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *ListConfigurationsURL) Build() (*url.URL, error) {
+ var _result url.URL
+
+ var _path = "/idp/{type}"
+
+ typeVar := o.Type
+ if typeVar != "" {
+ _path = strings.Replace(_path, "{type}", typeVar, -1)
+ } else {
+ return nil, errors.New("type is required on ListConfigurationsURL")
+ }
+
+ _basePath := o._basePath
+ if _basePath == "" {
+ _basePath = "/api/v1"
+ }
+ _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+ return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *ListConfigurationsURL) Must(u *url.URL, err error) *url.URL {
+ if err != nil {
+ panic(err)
+ }
+ if u == nil {
+ panic("url can't be nil")
+ }
+ return u
+}
+
+// String returns the string representation of the path with query string
+func (o *ListConfigurationsURL) String() string {
+ return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *ListConfigurationsURL) BuildFull(scheme, host string) (*url.URL, error) {
+ if scheme == "" {
+ return nil, errors.New("scheme is required for a full url on ListConfigurationsURL")
+ }
+ if host == "" {
+ return nil, errors.New("host is required for a full url on ListConfigurationsURL")
+ }
+
+ base, err := o.Build()
+ if err != nil {
+ return nil, err
+ }
+
+ base.Scheme = scheme
+ base.Host = host
+ return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *ListConfigurationsURL) StringFull(scheme, host string) string {
+ return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/restapi/operations/idp/update_configuration.go b/restapi/operations/idp/update_configuration.go
new file mode 100644
index 0000000000..f6f090ce7e
--- /dev/null
+++ b/restapi/operations/idp/update_configuration.go
@@ -0,0 +1,88 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime/middleware"
+
+ "github.com/minio/console/models"
+)
+
+// UpdateConfigurationHandlerFunc turns a function with the right signature into a update configuration handler
+type UpdateConfigurationHandlerFunc func(UpdateConfigurationParams, *models.Principal) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn UpdateConfigurationHandlerFunc) Handle(params UpdateConfigurationParams, principal *models.Principal) middleware.Responder {
+ return fn(params, principal)
+}
+
+// UpdateConfigurationHandler interface for that can handle valid update configuration params
+type UpdateConfigurationHandler interface {
+ Handle(UpdateConfigurationParams, *models.Principal) middleware.Responder
+}
+
+// NewUpdateConfiguration creates a new http.Handler for the update configuration operation
+func NewUpdateConfiguration(ctx *middleware.Context, handler UpdateConfigurationHandler) *UpdateConfiguration {
+ return &UpdateConfiguration{Context: ctx, Handler: handler}
+}
+
+/*
+ UpdateConfiguration swagger:route PUT /idp/{type}/{name} idp updateConfiguration
+
+Update IDP Configuration
+*/
+type UpdateConfiguration struct {
+ Context *middleware.Context
+ Handler UpdateConfigurationHandler
+}
+
+func (o *UpdateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+ route, rCtx, _ := o.Context.RouteInfo(r)
+ if rCtx != nil {
+ *r = *rCtx
+ }
+ var Params = NewUpdateConfigurationParams()
+ uprinc, aCtx, err := o.Context.Authorize(r, route)
+ if err != nil {
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+ if aCtx != nil {
+ *r = *aCtx
+ }
+ var principal *models.Principal
+ if uprinc != nil {
+ principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
+ }
+
+ if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+ o.Context.Respond(rw, r, route.Produces, route, err)
+ return
+ }
+
+ res := o.Handler.Handle(Params, principal) // actually handle the request
+ o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/restapi/operations/idp/update_configuration_parameters.go b/restapi/operations/idp/update_configuration_parameters.go
new file mode 100644
index 0000000000..da909fd773
--- /dev/null
+++ b/restapi/operations/idp/update_configuration_parameters.go
@@ -0,0 +1,150 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "io"
+ "net/http"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/runtime"
+ "github.com/go-openapi/runtime/middleware"
+ "github.com/go-openapi/strfmt"
+ "github.com/go-openapi/validate"
+
+ "github.com/minio/console/models"
+)
+
+// NewUpdateConfigurationParams creates a new UpdateConfigurationParams object
+//
+// There are no default values defined in the spec.
+func NewUpdateConfigurationParams() UpdateConfigurationParams {
+
+ return UpdateConfigurationParams{}
+}
+
+// UpdateConfigurationParams contains all the bound params for the update configuration operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters UpdateConfiguration
+type UpdateConfigurationParams struct {
+
+ // HTTP Request Object
+ HTTPRequest *http.Request `json:"-"`
+
+ /*
+ Required: true
+ In: body
+ */
+ Body *models.IdpServerConfiguration
+ /*IDP Configuration Name
+ Required: true
+ In: path
+ */
+ Name string
+ /*IDP Configuration Type
+ Required: true
+ In: path
+ */
+ Type string
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewUpdateConfigurationParams() beforehand.
+func (o *UpdateConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+ var res []error
+
+ o.HTTPRequest = r
+
+ if runtime.HasBody(r) {
+ defer r.Body.Close()
+ var body models.IdpServerConfiguration
+ if err := route.Consumer.Consume(r.Body, &body); err != nil {
+ if err == io.EOF {
+ res = append(res, errors.Required("body", "body", ""))
+ } else {
+ res = append(res, errors.NewParseError("body", "body", "", err))
+ }
+ } else {
+ // validate body object
+ if err := body.Validate(route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ ctx := validate.WithOperationRequest(r.Context())
+ if err := body.ContextValidate(ctx, route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ if len(res) == 0 {
+ o.Body = &body
+ }
+ }
+ } else {
+ res = append(res, errors.Required("body", "body", ""))
+ }
+
+ rName, rhkName, _ := route.Params.GetOK("name")
+ if err := o.bindName(rName, rhkName, route.Formats); err != nil {
+ res = append(res, err)
+ }
+
+ rType, rhkType, _ := route.Params.GetOK("type")
+ if err := o.bindType(rType, rhkType, route.Formats); err != nil {
+ res = append(res, err)
+ }
+ if len(res) > 0 {
+ return errors.CompositeValidationError(res...)
+ }
+ return nil
+}
+
+// bindName binds and validates parameter Name from path.
+func (o *UpdateConfigurationParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Name = raw
+
+ return nil
+}
+
+// bindType binds and validates parameter Type from path.
+func (o *UpdateConfigurationParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error {
+ var raw string
+ if len(rawData) > 0 {
+ raw = rawData[len(rawData)-1]
+ }
+
+ // Required: true
+ // Parameter is provided by construction from the route
+ o.Type = raw
+
+ return nil
+}
diff --git a/restapi/operations/idp/update_configuration_responses.go b/restapi/operations/idp/update_configuration_responses.go
new file mode 100644
index 0000000000..deb6d75c6f
--- /dev/null
+++ b/restapi/operations/idp/update_configuration_responses.go
@@ -0,0 +1,135 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+ "net/http"
+
+ "github.com/go-openapi/runtime"
+
+ "github.com/minio/console/models"
+)
+
+// UpdateConfigurationOKCode is the HTTP code returned for type UpdateConfigurationOK
+const UpdateConfigurationOKCode int = 200
+
+/*
+UpdateConfigurationOK A successful response.
+
+swagger:response updateConfigurationOK
+*/
+type UpdateConfigurationOK struct {
+
+ /*
+ In: Body
+ */
+ Payload *models.SetIDPResponse `json:"body,omitempty"`
+}
+
+// NewUpdateConfigurationOK creates UpdateConfigurationOK with default headers values
+func NewUpdateConfigurationOK() *UpdateConfigurationOK {
+
+ return &UpdateConfigurationOK{}
+}
+
+// WithPayload adds the payload to the update configuration o k response
+func (o *UpdateConfigurationOK) WithPayload(payload *models.SetIDPResponse) *UpdateConfigurationOK {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the update configuration o k response
+func (o *UpdateConfigurationOK) SetPayload(payload *models.SetIDPResponse) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *UpdateConfigurationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(200)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
+
+/*
+UpdateConfigurationDefault Generic error response.
+
+swagger:response updateConfigurationDefault
+*/
+type UpdateConfigurationDefault struct {
+ _statusCode int
+
+ /*
+ In: Body
+ */
+ Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewUpdateConfigurationDefault creates UpdateConfigurationDefault with default headers values
+func NewUpdateConfigurationDefault(code int) *UpdateConfigurationDefault {
+ if code <= 0 {
+ code = 500
+ }
+
+ return &UpdateConfigurationDefault{
+ _statusCode: code,
+ }
+}
+
+// WithStatusCode adds the status to the update configuration default response
+func (o *UpdateConfigurationDefault) WithStatusCode(code int) *UpdateConfigurationDefault {
+ o._statusCode = code
+ return o
+}
+
+// SetStatusCode sets the status to the update configuration default response
+func (o *UpdateConfigurationDefault) SetStatusCode(code int) {
+ o._statusCode = code
+}
+
+// WithPayload adds the payload to the update configuration default response
+func (o *UpdateConfigurationDefault) WithPayload(payload *models.Error) *UpdateConfigurationDefault {
+ o.Payload = payload
+ return o
+}
+
+// SetPayload sets the payload to the update configuration default response
+func (o *UpdateConfigurationDefault) SetPayload(payload *models.Error) {
+ o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *UpdateConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+ rw.WriteHeader(o._statusCode)
+ if o.Payload != nil {
+ payload := o.Payload
+ if err := producer.Produce(rw, payload); err != nil {
+ panic(err) // let the recovery middleware deal with this
+ }
+ }
+}
diff --git a/restapi/operations/idp/update_configuration_urlbuilder.go b/restapi/operations/idp/update_configuration_urlbuilder.go
new file mode 100644
index 0000000000..9432f5a45b
--- /dev/null
+++ b/restapi/operations/idp/update_configuration_urlbuilder.go
@@ -0,0 +1,124 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+
+package idp
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+ "errors"
+ "net/url"
+ golangswaggerpaths "path"
+ "strings"
+)
+
+// UpdateConfigurationURL generates an URL for the update configuration operation
+type UpdateConfigurationURL struct {
+ Name string
+ Type string
+
+ _basePath string
+ // avoid unkeyed usage
+ _ struct{}
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *UpdateConfigurationURL) WithBasePath(bp string) *UpdateConfigurationURL {
+ o.SetBasePath(bp)
+ return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *UpdateConfigurationURL) SetBasePath(bp string) {
+ o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *UpdateConfigurationURL) Build() (*url.URL, error) {
+ var _result url.URL
+
+ var _path = "/idp/{type}/{name}"
+
+ name := o.Name
+ if name != "" {
+ _path = strings.Replace(_path, "{name}", name, -1)
+ } else {
+ return nil, errors.New("name is required on UpdateConfigurationURL")
+ }
+
+ typeVar := o.Type
+ if typeVar != "" {
+ _path = strings.Replace(_path, "{type}", typeVar, -1)
+ } else {
+ return nil, errors.New("type is required on UpdateConfigurationURL")
+ }
+
+ _basePath := o._basePath
+ if _basePath == "" {
+ _basePath = "/api/v1"
+ }
+ _result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+ return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *UpdateConfigurationURL) Must(u *url.URL, err error) *url.URL {
+ if err != nil {
+ panic(err)
+ }
+ if u == nil {
+ panic("url can't be nil")
+ }
+ return u
+}
+
+// String returns the string representation of the path with query string
+func (o *UpdateConfigurationURL) String() string {
+ return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *UpdateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) {
+ if scheme == "" {
+ return nil, errors.New("scheme is required for a full url on UpdateConfigurationURL")
+ }
+ if host == "" {
+ return nil, errors.New("host is required for a full url on UpdateConfigurationURL")
+ }
+
+ base, err := o.Build()
+ if err != nil {
+ return nil, err
+ }
+
+ base.Scheme = scheme
+ base.Host = host
+ return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *UpdateConfigurationURL) StringFull(scheme, host string) string {
+ return o.Must(o.BuildFull(scheme, host)).String()
+}
diff --git a/swagger-console.yml b/swagger-console.yml
index 358d34ad8f..87bdafc15c 100644
--- a/swagger-console.yml
+++ b/swagger-console.yml
@@ -3265,6 +3265,133 @@ paths:
$ref: "#/definitions/error"
tags:
- Inspect
+ /idp/{type}:
+ post:
+ summary: Create IDP Configuration
+ operationId: CreateConfiguration
+ parameters:
+ - name: type
+ description: IDP Configuration Type
+ in: path
+ required: true
+ type: string
+ - name: body
+ in: body
+ required: true
+ schema:
+ $ref: "#/definitions/idpServerConfiguration"
+ responses:
+ 201:
+ description: A successful response.
+ schema:
+ $ref: "#/definitions/setIDPResponse"
+ default:
+ description: Generic error response.
+ schema:
+ $ref: "#/definitions/error"
+ tags:
+ - idp
+ get:
+ summary: List IDP Configurations
+ operationId: ListConfigurations
+ parameters:
+ - name: type
+ description: IDP Configuration Type
+ in: path
+ required: true
+ type: string
+ responses:
+ 200:
+ description: A successful response.
+ schema:
+ $ref: "#/definitions/idpListConfigurationsResponse"
+ default:
+ description: Generic error response.
+ schema:
+ $ref: "#/definitions/error"
+ tags:
+ - idp
+ /idp/{type}/{name}:
+ get:
+ summary: Get IDP Configuration
+ operationId: GetConfiguration
+ parameters:
+ - name: name
+ description: IDP Configuration Name
+ in: path
+ required: true
+ type: string
+ - name: type
+ description: IDP Configuration Type
+ in: path
+ required: true
+ type: string
+ responses:
+ 200:
+ description: A successful response.
+ schema:
+ $ref: "#/definitions/idpServerConfiguration"
+ default:
+ description: Generic error response.
+ schema:
+ $ref: "#/definitions/error"
+ tags:
+ - idp
+ delete:
+ summary: Delete IDP Configuration
+ operationId: DeleteConfiguration
+ parameters:
+ - name: name
+ description: IDP Configuration Name
+ in: path
+ required: true
+ type: string
+ - name: type
+ description: IDP Configuration Type
+ in: path
+ required: true
+ type: string
+ responses:
+ 200:
+ description: A successful response.
+ schema:
+ $ref: "#/definitions/setIDPResponse"
+ default:
+ description: Generic error response.
+ schema:
+ $ref: "#/definitions/error"
+ tags:
+ - idp
+ put:
+ summary: Update IDP Configuration
+ operationId: UpdateConfiguration
+ parameters:
+ - name: body
+ in: body
+ required: true
+ schema:
+ $ref: "#/definitions/idpServerConfiguration"
+ - name: name
+ description: IDP Configuration Name
+ in: path
+ required: true
+ type: string
+ - name: type
+ description: IDP Configuration Type
+ in: path
+ required: true
+ type: string
+ responses:
+ 200:
+ description: A successful response.
+ schema:
+ $ref: "#/definitions/setIDPResponse"
+ default:
+ description: Generic error response.
+ schema:
+ $ref: "#/definitions/error"
+ tags:
+ - idp
definitions:
accountChangePasswordRequest:
@@ -5601,3 +5728,42 @@ definitions:
type: string
displayName:
type: string
+
+ idpServerConfiguration:
+ type: object
+ properties:
+ name:
+ type: string
+ input:
+ type: string
+ type:
+ type: string
+ enabled:
+ type: boolean
+ info:
+ type: array
+ items:
+ $ref: "#/definitions/idpServerConfigurationInfo"
+ idpServerConfigurationInfo:
+ type: object
+ properties:
+ key:
+ type: string
+ value:
+ type: string
+ isCfg:
+ type: boolean
+ isEnv:
+ type: boolean
+ idpListConfigurationsResponse:
+ type: object
+ properties:
+ results:
+ type: array
+ items:
+ $ref: "#/definitions/idpServerConfiguration"
+ setIDPResponse:
+ type: object
+ properties:
+ restart:
+ type: boolean