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:
Harshavardhana
2015-10-06 23:32:20 -07:00
parent 00b0f2e0d4
commit ee377c9bff
11 changed files with 356 additions and 1186 deletions
+11 -9
View File
@@ -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...)