public AccessTokenOauthModel GetToken(TokenModel model) { var ticketCache = _ticketManager.GetAuthorizeCode(model.code); var result = _ticketManager.GetToken(model.code).IsValid(); if (result) { return new AccessTokenOauthModel() { access_token = Guid.NewGuid().ToString(), expires_in = 3000 }; } throw new QsTechException("sadfsadf"); }
private bool CheckClient(TokenModel tokenArg,ref string message) { return true; }
public AccessTokenOauthModel GetTokenByAuthorizationCode(TokenModel tokenArg) { string msgref = ""; var ul = _authorizationCodeManager.GetUserInfoByAuthorizationCode(tokenArg.code, ref msgref); if (ul == null) return new AccessTokenOauthModel(){ ret = -10010, message = msgref}; var validClient = CheckClient(tokenArg, ref msgref); if (!validClient) return new AccessTokenOauthModel() { ret = -10011, message = msgref }; var token = GetMd5Str(Guid.NewGuid().ToString()); _cacheAccessToken.GetOrAdd(token, m => { m.Token = new DurationToken(accessDuration); return new UserLite(ul.UserId,ul.UserName); }); return new AccessTokenOauthModel(){ access_token = token, expires_in = (int)accessDuration.TotalSeconds}; }