diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-07-27 17:35:43 -0400 |
---|---|---|
committer | Elias Nahum <nahumhbl@gmail.com> | 2018-07-27 17:35:43 -0400 |
commit | 6ac82d5171769bf8d543cb6c017d29c0a4c81621 (patch) | |
tree | 945a5d1511b1eb4048bfaa4ea59777886713d797 /model | |
parent | 441c8741c1738e93258b861d92e4f7293203918a (diff) | |
download | chat-6ac82d5171769bf8d543cb6c017d29c0a4c81621.tar.gz chat-6ac82d5171769bf8d543cb6c017d29c0a4c81621.tar.bz2 chat-6ac82d5171769bf8d543cb6c017d29c0a4c81621.zip |
Implement OAuth2 implicit grant flow (#9178)
Diffstat (limited to 'model')
-rw-r--r-- | model/authorize.go | 3 | ||||
-rw-r--r-- | model/oauth.go | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/model/authorize.go b/model/authorize.go index 9fd5afa70..22325b181 100644 --- a/model/authorize.go +++ b/model/authorize.go @@ -12,6 +12,7 @@ import ( const ( AUTHCODE_EXPIRE_TIME = 60 * 10 // 10 minutes AUTHCODE_RESPONSE_TYPE = "code" + IMPLICIT_RESPONSE_TYPE = "token" DEFAULT_SCOPE = "user" ) @@ -58,7 +59,7 @@ func (ad *AuthData) IsValid() *AppError { return NewAppError("AuthData.IsValid", "model.authorize.is_valid.create_at.app_error", nil, "client_id="+ad.ClientId, http.StatusBadRequest) } - if len(ad.RedirectUri) == 0 || len(ad.RedirectUri) > 256 || !IsValidHttpUrl(ad.RedirectUri) { + if len(ad.RedirectUri) > 256 || !IsValidHttpUrl(ad.RedirectUri) { return NewAppError("AuthData.IsValid", "model.authorize.is_valid.redirect_uri.app_error", nil, "client_id="+ad.ClientId, http.StatusBadRequest) } diff --git a/model/oauth.go b/model/oauth.go index 0ea1aa4e2..6f662a5ab 100644 --- a/model/oauth.go +++ b/model/oauth.go @@ -109,7 +109,6 @@ func (a *OAuthApp) PreUpdate() { a.UpdateAt = GetMillis() } -// ToJson convert a User to a json string func (a *OAuthApp) ToJson() string { b, _ := json.Marshal(a) return string(b) @@ -135,7 +134,6 @@ func (a *OAuthApp) IsValidRedirectURL(url string) bool { return false } -// OAuthAppFromJson will decode the input and return a User func OAuthAppFromJson(data io.Reader) *OAuthApp { var app *OAuthApp json.NewDecoder(data).Decode(&app) |