forked from TrueCloudLab/frostfs-s3-gw
Refactoring auth package and move into API
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
d8d6dc7593
commit
b9972042fc
4 changed files with 90 additions and 93 deletions
20
api/auth/regexp-utils.go
Normal file
20
api/auth/regexp-utils.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package auth
|
||||
|
||||
import "regexp"
|
||||
|
||||
type regexpSubmatcher struct {
|
||||
re *regexp.Regexp
|
||||
}
|
||||
|
||||
func (r *regexpSubmatcher) getSubmatches(target string) map[string]string {
|
||||
matches := r.re.FindStringSubmatch(target)
|
||||
l := len(matches)
|
||||
|
||||
sub := make(map[string]string, l)
|
||||
for i, name := range r.re.SubexpNames() {
|
||||
if i > 0 && i <= l {
|
||||
sub[name] = matches[i]
|
||||
}
|
||||
}
|
||||
return sub
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue