Implement authorization support

This commit is contained in:
Harshavardhana
2015-02-06 02:08:52 -08:00
parent eba86c07e9
commit 81fc11ee5d
4 changed files with 234 additions and 188 deletions

View File

@@ -8,3 +8,21 @@ const (
func isalnum(c byte) bool {
return '0' <= c && c <= '9' || 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
}
func ValidateAccessKey(key []byte) bool {
for _, char := range key {
if isalnum(char) {
continue
}
switch char {
case '-':
case '.':
case '_':
case '~':
continue
default:
return false
}
}
return true
}