add changelog
remove unused mux cleanup k6 test
This commit is contained in:
1 parent
11ba46eb88
commit
cb2e2a3896
3 files changed
+15
-10
No files matched your search
@@ -0,0 +1,8 @@
|
|||||||
|
Change: Cache password validation
|
||||||
|
|
||||||
|
Tags: accounts
|
||||||
|
|
||||||
|
The password validity check for requests like `login eq '%s' and password eq '%s'` is now cached for 10 minutes.
|
||||||
|
This improves the performance for basic auth requests.
|
||||||
|
|
||||||
|
https://github.com/owncloud/ocis/pull/958
|
||||||
@@ -2,13 +2,11 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/oidc"
|
"github.com/owncloud/ocis/ocis-pkg/oidc"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const publicFilesEndpoint = "/remote.php/dav/public-files/"
|
const publicFilesEndpoint = "/remote.php/dav/public-files/"
|
||||||
@@ -59,22 +57,21 @@ type basicAuth struct {
|
|||||||
logger log.Logger
|
logger log.Logger
|
||||||
enabled bool
|
enabled bool
|
||||||
accountsClient accounts.AccountsService
|
accountsClient accounts.AccountsService
|
||||||
m sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *basicAuth) isPublicLink(req *http.Request) bool {
|
func (m basicAuth) isPublicLink(req *http.Request) bool {
|
||||||
login, _, ok := req.BasicAuth()
|
login, _, ok := req.BasicAuth()
|
||||||
|
|
||||||
return ok && login == "public" && strings.HasPrefix(req.URL.Path, publicFilesEndpoint)
|
return ok && login == "public" && strings.HasPrefix(req.URL.Path, publicFilesEndpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *basicAuth) isBasicAuth(req *http.Request) bool {
|
func (m basicAuth) isBasicAuth(req *http.Request) bool {
|
||||||
login, password, ok := req.BasicAuth()
|
login, password, ok := req.BasicAuth()
|
||||||
|
|
||||||
return m.enabled && ok && login != "" && password != ""
|
return m.enabled && ok && login != "" && password != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *basicAuth) getAccount(req *http.Request) (*accounts.Account, bool) {
|
func (m basicAuth) getAccount(req *http.Request) (*accounts.Account, bool) {
|
||||||
login, password, _ := req.BasicAuth()
|
login, password, _ := req.BasicAuth()
|
||||||
|
|
||||||
account, status := getAccount(
|
account, status := getAccount(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {sleep, check} from 'k6';
|
import {sleep, check} from 'k6';
|
||||||
import {Options} from "k6/options";
|
import {Options} from "k6/options";
|
||||||
import {defaults, api, utils} from "./lib";
|
import {defaults, api} from "./lib";
|
||||||
|
|
||||||
const files = {
|
const files = {
|
||||||
'kb_50.jpg': open('./_files/kb_50.jpg', 'b'),
|
'kb_50.jpg': open('./_files/kb_50.jpg', 'b'),
|
||||||
@@ -13,7 +13,7 @@ export let options: Options = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const res = api.uploadFile(defaults.accounts.einstein, files['kb_50.jpg'], `kb_50-${utils.randomString()}.jpg`)
|
const res = api.uploadFile(defaults.accounts.einstein, files['kb_50.jpg'], `kb_50-${__VU}-${__ITER}.jpg`)
|
||||||
|
|
||||||
check(res, {
|
check(res, {
|
||||||
'status is 201': () => res.status === 201,
|
'status is 201': () => res.status === 201,
|
||||||
|
|||||||
Reference in new issue
Block a user