mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
Enforce signature v4 tests all the time, server defaults to only authenticated requests.
All requests must be authenticated to minio server from now on by using keys generated at
``${HOME}/.minio/users.json`` - from ``minio controller`` during its first time run.
Add a new hidden option ``--anonymous`` for running server in unauthenticated mode.
This commit is contained in:
+11
-9
@@ -64,31 +64,33 @@ type APIOperation struct {
|
||||
|
||||
// API container for API and also carries OP (operation) channel
|
||||
type API struct {
|
||||
OP chan APIOperation
|
||||
Donut donut.Interface
|
||||
OP chan APIOperation
|
||||
Donut donut.Interface
|
||||
Anonymous bool // do not checking for incoming signatures, allow all requests
|
||||
}
|
||||
|
||||
// getNewAPI instantiate a new minio API
|
||||
func getNewAPI() API {
|
||||
func getNewAPI(anonymous bool) API {
|
||||
// ignore errors for now
|
||||
d, err := donut.New()
|
||||
fatalIf(err.Trace(), "Instantiating donut failed.", nil)
|
||||
|
||||
return API{
|
||||
OP: make(chan APIOperation),
|
||||
Donut: d,
|
||||
OP: make(chan APIOperation),
|
||||
Donut: d,
|
||||
Anonymous: anonymous,
|
||||
}
|
||||
}
|
||||
|
||||
// getAPIHandler api handler
|
||||
func getAPIHandler(api API) http.Handler {
|
||||
func getAPIHandler(anonymous bool, api API) http.Handler {
|
||||
var mwHandlers = []MiddlewareHandler{
|
||||
TimeValidityHandler,
|
||||
IgnoreResourcesHandler,
|
||||
SignatureHandler,
|
||||
// api.LoggingHandler, // Disabled logging until we bring in external logging support
|
||||
CorsHandler,
|
||||
}
|
||||
if !anonymous {
|
||||
mwHandlers = append(mwHandlers, SignatureHandler)
|
||||
}
|
||||
mux := router.NewRouter()
|
||||
registerAPI(mux, api)
|
||||
apiHandler := registerCustomMiddleware(mux, mwHandlers...)
|
||||
|
||||
Reference in New Issue
Block a user