コード例 #1
0
        /// <summary>
        /// handle implicit token request
        /// </summary>
        protected virtual async Task ImplicitTokenRequestHandler(HttpContext context, IClient client, string scopesStr, string redirectURI, string state)
        {
            var token = await _tokenGenerator.GenerateAccessTokenAsync(
                context : context
                , grantType : GrantType.Implicit
                , client : client
                , scopes : scopesStr.Split(OAuth2Consts.Seperator_Scope)
                , username : context.User.Identity.Name
                );

            context.Response.Redirect($"{redirectURI}?{OAuth2Consts.Form_AccessToken}={Uri.EscapeDataString(token)}&{OAuth2Consts.Form_TokenType}=Bearer&{OAuth2Consts.Form_ExpiresIn}={client.AccessTokenExpireSeconds}&{OAuth2Consts.Form_Scope}={Uri.EscapeDataString(scopesStr)}&{OAuth2Consts.Form_State}={Uri.EscapeDataString(state)}");
        }