// ReSharper disable InconsistentNaming
    public ActionResult AuthoriseRequestToken(string oauth_token, string oauth_callback)
// ReSharper restore InconsistentNaming
    {
      var requestToken = _tokenRepository.GetRequestToken(oauth_token);
      if(requestToken!=null)
      {
        requestToken.AccessDenied = false;
        var accessToken = new AccessToken
                            {
                              ConsumerKey = requestToken.ConsumerKey,
                              ExpireyDate = DateTime.UtcNow.AddDays(20),
                              Realm = requestToken.Realm,
                              Token = Guid.NewGuid().ToString(),
                              TokenSecret = Guid.NewGuid().ToString(),
                              UserName = Guid.NewGuid().ToString(),
                            };
        requestToken.AccessToken = accessToken;
        _tokenRepository.SaveAccessToken(accessToken);
        _tokenRepository.SaveRequestToken(requestToken);
        return new JsonResult {Data=accessToken};
      }
      return new EmptyResult();
     
    }
Example #2
0
 public void SaveAccessToken(AccessToken token)
 {
     _accessTokens[token.Token] = token;
 }