Ejemplo n.º 1
0
        public TokenResponseMessage CreateResponse(TokenRequestMessage message, NameValueCollection additionalInfo)
        {
            TokenResponseMessage response = new TokenResponseMessage();

            response.AccessToken          = this.CreateAccessToken(message, additionalInfo);
            response.RefreshToken         = this.CreateRefreshToken();
            response.AccessTokenExpiresIn = TimeSpan.FromSeconds(this.serviceConfig.SimpleWebTokenHandlerConfiguration.Issuer.TokenExpirationInSeconds);

            return(response);
        }
Ejemplo n.º 2
0
        public void SendResponse(TokenResponseMessage message)
        {
            HttpResponse response = HttpContext.Current.Response;
            string       body;

            body  = OAuthConstants.AccessToken + '=' + HttpUtility.UrlEncode(message.AccessToken);
            body += '&' + OAuthConstants.TokenExpiresIn + '=' + ((int)message.AccessTokenExpiresIn.TotalSeconds).ToString();
            body += '&' + OAuthConstants.RefreshToken + '=' + message.RefreshToken;
            response.Write(body);
            response.End();
        }