Skip to content

Commit 3dc0fdc

Browse files
authored
Remove more unused APIs (#3537)
* Remove more unused APIs * prettier * Fix Test * Fix tests * Remove SSO Integreation * fix tests * lint
1 parent e2bbf91 commit 3dc0fdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+74
-4337
lines changed

.github/workflows/jobs.yaml

Lines changed: 53 additions & 152 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -140,56 +140,6 @@ test-replication:
140140
@(docker stop minio2 || true)
141141
@(docker network rm mynet123 || true)
142142

143-
test-sso-integration:
144-
@echo "create the network in bridge mode to communicate all containers"
145-
@(docker network create my-net)
146-
@echo "run openldap container using MinIO Image: quay.io/minio/openldap:latest"
147-
@(docker run \
148-
-e LDAP_ORGANIZATION="MinIO Inc" \
149-
-e LDAP_DOMAIN="min.io" \
150-
-e LDAP_ADMIN_PASSWORD="admin" \
151-
--network my-net \
152-
-p 389:389 \
153-
-p 636:636 \
154-
--name openldap \
155-
--detach quay.io/minio/openldap:latest)
156-
@echo "Run Dex container using MinIO Image: quay.io/minio/dex:latest"
157-
@(docker run \
158-
-e DEX_ISSUER=http://dex:5556/dex \
159-
-e DEX_CLIENT_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
160-
-e DEX_LDAP_SERVER=openldap:389 \
161-
--network my-net \
162-
-p 5556:5556 \
163-
--name dex \
164-
--detach quay.io/minio/dex:latest)
165-
@echo "running minio server"
166-
@(docker run \
167-
-v /data1 -v /data2 -v /data3 -v /data4 \
168-
--network my-net \
169-
-d \
170-
--name minio \
171-
--rm \
172-
-p 9000:9000 \
173-
-p 9001:9001 \
174-
-e MINIO_IDENTITY_OPENID_CLIENT_ID="minio-client-app" \
175-
-e MINIO_IDENTITY_OPENID_CLIENT_SECRET="minio-client-app-secret" \
176-
-e MINIO_IDENTITY_OPENID_CLAIM_NAME=name \
177-
-e MINIO_IDENTITY_OPENID_CONFIG_URL=http://dex:5556/dex/.well-known/openid-configuration \
178-
-e MINIO_IDENTITY_OPENID_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
179-
-e MINIO_ROOT_USER=minio \
180-
-e MINIO_ROOT_PASSWORD=minio123 $(MINIO_VERSION) server /data{1...4} --address :9000 --console-address :9001)
181-
@echo "run mc commands to set the policy"
182-
@(docker run --name minio-client --network my-net -dit --entrypoint=/bin/sh minio/mc)
183-
@(docker exec minio-client mc alias set myminio/ http://minio:9000 minio minio123)
184-
@echo "adding policy to Dillon Harper to be able to login:"
185-
@(cd sso-integration && docker cp allaccess.json minio-client:/ && docker exec minio-client mc admin policy create myminio "Dillon Harper" allaccess.json)
186-
@echo "starting bash script"
187-
@(env bash $(PWD)/sso-integration/set-sso.sh)
188-
@echo "add python module"
189-
@(pip3 install bs4)
190-
@echo "Executing the test:"
191-
@(cd sso-integration && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./sso-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/sso-system.out)
192-
193143
test-permissions-1:
194144
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
195145
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-1/")

api/client.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import (
3131

3232
"github.com/minio/console/models"
3333
"github.com/minio/console/pkg"
34-
"github.com/minio/console/pkg/auth"
35-
"github.com/minio/console/pkg/auth/ldap"
3634
xjwt "github.com/minio/console/pkg/auth/token"
3735
mc "github.com/minio/mc/cmd"
3836
"github.com/minio/mc/pkg/probe"
@@ -333,44 +331,6 @@ func stsCredentials(minioURL, accessKey, secretKey, location string, client *htt
333331
func NewConsoleCredentials(accessKey, secretKey, location string, client *http.Client) (*credentials.Credentials, error) {
334332
minioURL := getMinIOServer()
335333

336-
// LDAP authentication for Console
337-
if ldap.GetLDAPEnabled() {
338-
creds, err := auth.GetCredentialsFromLDAP(client, minioURL, accessKey, secretKey)
339-
if err != nil {
340-
return nil, err
341-
}
342-
343-
credContext := &credentials.CredContext{
344-
Client: client,
345-
}
346-
347-
// We verify if LDAP credentials are correct and no error is returned
348-
_, err = creds.GetWithContext(credContext)
349-
350-
if err != nil && strings.Contains(strings.ToLower(err.Error()), "not found") {
351-
// We try to use STS Credentials in case LDAP credentials are incorrect.
352-
stsCreds, errSTS := stsCredentials(minioURL, accessKey, secretKey, location, client)
353-
354-
// If there is an error with STS too, then we return the original LDAP error
355-
if errSTS != nil {
356-
LogError("error in STS credentials for LDAP case: %v ", errSTS)
357-
358-
// We return LDAP result
359-
return creds, nil
360-
}
361-
362-
_, err := stsCreds.GetWithContext(credContext)
363-
// There is an error with STS credentials, We return the result of LDAP as STS is not a priority in this case.
364-
if err != nil {
365-
return creds, nil
366-
}
367-
368-
return stsCreds, nil
369-
}
370-
371-
return creds, nil
372-
}
373-
374334
return stsCredentials(minioURL, accessKey, secretKey, location, client)
375335
}
376336

api/config.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,6 @@ func GetSecureSTSPreload() bool {
227227
return strings.ToLower(env.Get(ConsoleSecureSTSPreload, "off")) == "on"
228228
}
229229

230-
// If TLSTemporaryRedirect is true, the a 302 will be used while redirecting. Default is false (301).
231-
func GetSecureTLSTemporaryRedirect() bool {
232-
return strings.ToLower(env.Get(ConsoleSecureTLSTemporaryRedirect, "off")) == "on"
233-
}
234-
235230
// STS header is only included when the connection is HTTPS.
236231
func GetSecureForceSTSHeader() bool {
237232
return strings.ToLower(env.Get(ConsoleSecureForceSTSHeader, "off")) == "on"
@@ -254,18 +249,6 @@ func getLogSearchAPIToken() string {
254249
return env.Get(LogSearchQueryAuthToken, "")
255250
}
256251

257-
func getLogSearchURL() string {
258-
return env.Get(ConsoleLogQueryURL, "")
259-
}
260-
261-
func getPrometheusURL() string {
262-
return env.Get(PrometheusURL, "")
263-
}
264-
265-
func getPrometheusJobID() string {
266-
return env.Get(PrometheusJobID, "minio-job")
267-
}
268-
269252
func getMaxConcurrentUploadsLimit() int64 {
270253
cu, err := strconv.ParseInt(env.Get(ConsoleMaxConcurrentUploads, "10"), 10, 64)
271254
if err != nil {

api/config_test.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -227,72 +227,6 @@ func Test_getLogSearchAPIToken(t *testing.T) {
227227
}
228228
}
229229

230-
func Test_getPrometheusURL(t *testing.T) {
231-
type args struct {
232-
env string
233-
}
234-
tests := []struct {
235-
name string
236-
args args
237-
want string
238-
}{
239-
{
240-
name: "env set",
241-
args: args{
242-
env: "value",
243-
},
244-
want: "value",
245-
},
246-
{
247-
name: "env not set",
248-
args: args{
249-
env: "",
250-
},
251-
want: "",
252-
},
253-
}
254-
for _, tt := range tests {
255-
t.Run(tt.name, func(_ *testing.T) {
256-
os.Setenv(PrometheusURL, tt.args.env)
257-
assert.Equalf(t, tt.want, getPrometheusURL(), "getPrometheusURL()")
258-
os.Setenv(PrometheusURL, tt.args.env)
259-
})
260-
}
261-
}
262-
263-
func Test_getPrometheusJobID(t *testing.T) {
264-
type args struct {
265-
env string
266-
}
267-
tests := []struct {
268-
name string
269-
args args
270-
want string
271-
}{
272-
{
273-
name: "env set",
274-
args: args{
275-
env: "value",
276-
},
277-
want: "value",
278-
},
279-
{
280-
name: "env not set",
281-
args: args{
282-
env: "",
283-
},
284-
want: "minio-job",
285-
},
286-
}
287-
for _, tt := range tests {
288-
t.Run(tt.name, func(_ *testing.T) {
289-
os.Setenv(PrometheusJobID, tt.args.env)
290-
assert.Equalf(t, tt.want, getPrometheusJobID(), "getPrometheusJobID()")
291-
os.Setenv(PrometheusJobID, tt.args.env)
292-
})
293-
}
294-
}
295-
296230
func Test_getMaxConcurrentUploadsLimit(t *testing.T) {
297231
type args struct {
298232
env string

api/consts.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package api
2020
const (
2121
// Constants for common configuration
2222
ConsoleMinIOServer = "CONSOLE_MINIO_SERVER"
23-
ConsoleSubnetProxy = "CONSOLE_SUBNET_PROXY"
2423
ConsoleMinIORegion = "CONSOLE_MINIO_REGION"
2524
ConsoleHostname = "CONSOLE_HOSTNAME"
2625
ConsolePort = "CONSOLE_PORT"
@@ -40,16 +39,9 @@ const (
4039
ConsoleSecureSTSPreload = "CONSOLE_SECURE_STS_PRELOAD"
4140
ConsoleSecureTLSRedirect = "CONSOLE_SECURE_TLS_REDIRECT"
4241
ConsoleSecureTLSHost = "CONSOLE_SECURE_TLS_HOST"
43-
ConsoleSecureTLSTemporaryRedirect = "CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT"
4442
ConsoleSecureForceSTSHeader = "CONSOLE_SECURE_FORCE_STS_HEADER"
45-
ConsoleSecurePublicKey = "CONSOLE_SECURE_PUBLIC_KEY"
4643
ConsoleSecureReferrerPolicy = "CONSOLE_SECURE_REFERRER_POLICY"
4744
ConsoleSecureFeaturePolicy = "CONSOLE_SECURE_FEATURE_POLICY"
48-
ConsoleSecureExpectCTHeader = "CONSOLE_SECURE_EXPECT_CT_HEADER"
49-
PrometheusURL = "CONSOLE_PROMETHEUS_URL"
50-
PrometheusAuthToken = "CONSOLE_PROMETHEUS_AUTH_TOKEN"
51-
PrometheusJobID = "CONSOLE_PROMETHEUS_JOB_ID"
52-
PrometheusExtraLabels = "CONSOLE_PROMETHEUS_EXTRA_LABELS"
5345
ConsoleLogQueryURL = "CONSOLE_LOG_QUERY_URL"
5446
ConsoleLogQueryAuthToken = "CONSOLE_LOG_QUERY_AUTH_TOKEN"
5547
ConsoleMaxConcurrentUploads = "CONSOLE_MAX_CONCURRENT_UPLOADS"

0 commit comments

Comments
 (0)