Example #1
0
        static Token GetToken(GmxOAuthOptions options, string code)
        {
            var url         = string.Format("{0}/oAuth/AccessToken?client_id={1}&client_secret={2}&code={3}", options.AuthenticationEndpoint, options.ClientId, options.ClientSecret, code);
            var tokenStream = GetBytesFromUrl(url);
            var oResult     = ParseResponse(tokenStream);
            var dtExpires   = oResult["expires"].Value <DateTime>();

            return(new Token(oResult["access_token"].Value <string>(), dtExpires)
            {
                ClientData = oResult["scope"].Value <string>()
            });
        }
Example #2
0
 public GmxOAuth(RequestDelegate next, IMemoryCache cache, IOptions <GmxOAuthOptions> options)
 {
     this._next    = next;
     this._cache   = cache;
     this._options = options.Value;
 }
 public static IApplicationBuilder UseGmxOAuth(this IApplicationBuilder builder, GmxOAuthOptions options)
 {
     return(builder.UseMiddleware <GmxOAuth>(new OptionsWrapper <GmxOAuthOptions>(options)));
 }