Implement OAuth2 implicit grant flow (#9178)
Этот коммит содержится в:
коммит произвёл
Elias Nahum
родитель
441c8741c1
Коммит
6ac82d5171
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Ссылка в новой задаче
Block a user