Have simpler JWT authentication. (#3501)

This commit is contained in:
Bala FA
2016-12-27 21:58:10 +05:30
committed by Harshavardhana
parent 69559aa101
commit ee0172dfe4
17 changed files with 277 additions and 495 deletions

View File

@@ -72,3 +72,15 @@ type credential struct {
func newCredential() credential {
return credential{mustGetAccessKey(), mustGetSecretKey()}
}
func getCredential(accessKey, secretKey string) (credential, error) {
if !isAccessKeyValid(accessKey) {
return credential{}, errInvalidAccessKeyLength
}
if !isSecretKeyValid(secretKey) {
return credential{}, errInvalidSecretKeyLength
}
return credential{accessKey, secretKey}, nil
}