当前位置: 首页>>代码示例>>C#>>正文


C# OAuth.OAuthTokenEndpointContext类代码示例

本文整理汇总了C#中Microsoft.Owin.Security.OAuth.OAuthTokenEndpointContext的典型用法代码示例。如果您正苦于以下问题:C# OAuthTokenEndpointContext类的具体用法?C# OAuthTokenEndpointContext怎么用?C# OAuthTokenEndpointContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OAuthTokenEndpointContext类属于Microsoft.Owin.Security.OAuth命名空间,在下文中一共展示了OAuthTokenEndpointContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TokenEndpoint

        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {
            foreach (var claim in context.Identity.Claims)
            {
                if (claim.Type == ClaimTypes.Email)
                {
                    context.AdditionalResponseParameters.Add("email", claim.Value);
                }

                if (claim.Type == ClaimTypes.Role)
                {
                    context.AdditionalResponseParameters.Add("role", claim.Value);
                }

                if (claim.Type == ClaimTypes.MobilePhone)
                {
                    context.AdditionalResponseParameters.Add("mobile_number", claim.Value);
                }

                if (claim.Type == ClaimTypes.Country)
                {
                    context.AdditionalResponseParameters.Add("country", claim.Value);
                }

                if(claim.Type == "MobileNumberConfirmed")
                {
                    context.AdditionalResponseParameters.Add("mobile_number_confirmed", claim.Value);
                }
            }

            return Task.FromResult<object>(null);
        }
开发者ID:mustee,项目名称:Voting,代码行数:32,代码来源:AuthorizationServerProvider.cs

示例2: TokenEndpoint

 public override async Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
     {
         context.AdditionalResponseParameters.Add(property.Key, property.Value);
     }
 }
开发者ID:dude3133,项目名称:Abit-info,代码行数:7,代码来源:ApplicationOAuthProvider.cs

示例3: TokenEndpoint

        public override Task TokenEndpoint(OAuthTokenEndpointContext context) {
            foreach (KeyValuePair<string, string> property in context.Properties.Dictionary) {
                context.AdditionalResponseParameters.Add(property.Key, property.Value);
            }

            return Task.FromResult<object>(null);
        }
开发者ID:sarahywloo,项目名称:BigFixer,代码行数:7,代码来源:ApplicationOAuthProvider.cs

示例4: TokenEndpoint

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     var isFilledClaim = context.Identity.Claims.FirstOrDefault(x => x.Type == "profileFiled");
     if (isFilledClaim != null)
     {
         var isFilled = isFilledClaim.Value;
         context.AdditionalResponseParameters.Add("isFilled",bool.Parse(isFilled));
     }
     return base.TokenEndpoint(context);
 }
开发者ID:DrNorton,项目名称:GoSmoke,代码行数:10,代码来源:SimpleAuthorizationServerProvider.cs

示例5: TokenEndpoint

 /// <summary>
 /// Is used to add additional return values to the token response message
 /// </summary>
 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     foreach (var property in context.Properties.Dictionary)
     {
         context.AdditionalResponseParameters.Add(property.Key, property.Value);
     }
     //var userSessionClaim = context.Identity.FindFirst(claim => claim.Type == ApiConstants.Claims.UserSessionID);
     //context.AdditionalResponseParameters.Add(userSessionClaim.Type, userSessionClaim.Value);
     return Task.FromResult<object>(null);
 }
开发者ID:basharathussain,项目名称:doctors_app,代码行数:13,代码来源:AuthorizationServerProvider.cs

示例6: TokenEndpoint

        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {

            #region " Getting time to update service country and lease time "
            Int32 UpdateTimeInMinutes = 5;
            if (WebConfigurationManager.AppSettings["UpdateTimeInMinutes"] != null && WebConfigurationManager.AppSettings["UpdateTimeInMinutes"].Trim().Length > 0)
            {
                UpdateTimeInMinutes = Convert.ToInt32(WebConfigurationManager.AppSettings["UpdateTimeInMinutes"].Trim());
            }
            #endregion

            #region " Getting Token Expiry Time from Config file "
            Int32 days = 0;
            if (WebConfigurationManager.AppSettings["ExpiryDateTimeInDays"] != null && WebConfigurationManager.AppSettings["ExpiryDateTimeInDays"].Trim().Length > 0)
            {
                days = Convert.ToInt32(WebConfigurationManager.AppSettings["ExpiryDateTimeInDays"].Trim());
            } 
            #endregion

            #region " Assigning Token Expiry Time "
            foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
            {
                //.expires
                if (property.Key == ".expires")
                {
                    context.AdditionalResponseParameters.Add(property.Key, DateTime.Today.AddDays(days));
                }
                else if (property.Key == "expires_in")
                {
                    int seconds = days * 60 * 60;
                    context.AdditionalResponseParameters.Add(property.Key, seconds);
                }
                else
                {
                    context.AdditionalResponseParameters.Add(property.Key, property.Value);
                }

            } 
            #endregion

            #region " Writting values in Response object "
            context.AdditionalResponseParameters.Add("userName", userADName);
            context.AdditionalResponseParameters.Add("userEmail", userADEmail);
            context.AdditionalResponseParameters.Add("userPhone", userADPhone);
            context.AdditionalResponseParameters.Add("UpdateTimeInMinutes", UpdateTimeInMinutes); 
            #endregion
            return Task.FromResult<object>(null);
        }
开发者ID:Kashifabbas,项目名称:Finance.Services,代码行数:48,代码来源:ApplicationOAuthProvider.cs

示例7: TokenEndpoint

        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var claims = context.Identity.Claims.ToArray();
            foreach (var claim in claims)
            {
                if (claim.ValueType == "self")
                {
                    context.AdditionalResponseParameters[claim.Type] = claim.Value;
                    context.Identity.RemoveClaim(claim);
                }
            }
            return base.TokenEndpoint(context);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:18,代码来源:SimpleAuthorizationServerProvider.cs

示例8: TokenEndpoint

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
     {
         context.AdditionalResponseParameters.Add(property.Key, property.Value);
     }
     # region Response back some additional parameters by using /Token method OR Identity
     if (HttpContext.Current.Request.Browser["IsMobileDevice"] == "true")
     {
         context.AdditionalResponseParameters.Add("AntiForgeryToken", deviceId);
     }
     else 
     {
         context.AdditionalResponseParameters.Add("AntiForgeryToken", ip);
     }
     #endregion
     return Task.FromResult<object>(null);
 }
开发者ID:syatin003,项目名称:stepan_api_first,代码行数:18,代码来源:ApplicationOAuthProvider.cs

示例9: TokenEndpoint

        public override async Task TokenEndpoint(OAuthTokenEndpointContext context)
        {


           
                context.AdditionalResponseParameters.Add("empresaId", _usuario.EmpresaId);
                context.AdditionalResponseParameters.Add("ImagemUsuario", _usuario.ImagemUsuario);
                context.AdditionalResponseParameters.Add("EmpresaImagem", _usuario.Empresa.EmpresaImagem);
                context.AdditionalResponseParameters.Add("NomeEmpresa", _usuario.Empresa.NomeEmpresa);

            foreach (var role in _roles)
            {
                context.AdditionalResponseParameters.Add("roles", role.Key);
                context.AdditionalResponseParameters.Add("IdRole", role.Value);
            }

            await Task.FromResult(context);

        }
开发者ID:YuleSouza,项目名称:Loja,代码行数:19,代码来源:AuthAuthorizationServerProvider.cs

示例10: TokenEndpoint

        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {
            var issued = context.Properties.Dictionary[".issued"];
            var expires = context.Properties.Dictionary[".expires"];
            var roles = context.Properties.Dictionary["roles"];
            var userId = context.Properties.Dictionary["userId"];
            var userName = context.Properties.Dictionary["userName"];
            var firstName = context.Properties.Dictionary["firstName"];
            var lastName = context.Properties.Dictionary["lastName"];

            context.AdditionalResponseParameters.Add(".issued", issued);
            context.AdditionalResponseParameters.Add(".expires", expires);
            context.AdditionalResponseParameters.Add("roles", roles);
            context.AdditionalResponseParameters.Add("userId", userId);
            context.AdditionalResponseParameters.Add("userName", userName);
            context.AdditionalResponseParameters.Add("firstName", firstName);
            context.AdditionalResponseParameters.Add("lastName", lastName);

            return Task.FromResult<object>(null);
        }
开发者ID:eddievagabond,项目名称:angular-oauth-base,代码行数:20,代码来源:CustomOAuthProvider.cs

示例11: TokenEndpoint

 public Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     throw new NotImplementedException();
 }
开发者ID:RolandTG,项目名称:OwinSamples,代码行数:4,代码来源:AuthorizationServerProvider.cs

示例12: TokenEndpoint

        /// <summary>
        /// Called at the final stage of a successful Token endpoint request. An application may implement this call in order to do any final 
        /// modification of the claims being used to issue access or refresh tokens. This call may also be used in order to add additional 
        /// response parameters to the Token endpoint's json response body.
        /// </summary>
        /// <param name="context">The context of the event carries information in and results out.</param>
        /// <returns>Task to enable asynchronous execution</returns>
        public override Task TokenEndpoint(OAuthTokenEndpointContext context)
        {
            // Add all entries that we've added to the validated ticket (using the AuthenticationProperties):
            foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
            {
                context.AdditionalResponseParameters.Add(property.Key, property.Value);
            }

            return Task.FromResult<object>(null);
        }
开发者ID:nicolaihald,项目名称:OAuthDemo,代码行数:17,代码来源:DemoAuthorizationServerProvider.cs

示例13: TokenEndpoint

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
     {
         context.AdditionalResponseParameters.Add(property.Key, property.Value);
     }
     //to jest tymczasowe rozwiązanie , czyli pewnie juz tak zostanie 
     context.AdditionalResponseParameters.Add("roles",
         context.Identity.Name == "Admin" ? "Admin" : "User");
     return Task.FromResult<object>(null);
 }
开发者ID:Gangrena,项目名称:WebBellwether,代码行数:11,代码来源:SimpleAuthorizationServerProvider.cs

示例14: TokenEndpoint

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     //Called at the final stage of a successful Token endpoint request. do any final modification of the claims being used to issue access or refresh tokens
     return base.TokenEndpoint(context);
 }
开发者ID:cecilphillipTK,项目名称:webapi2-security-samples,代码行数:5,代码来源:CustomAuthorizationServerProvider.cs

示例15: TokenEndpoint

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
 {
     foreach (KeyValuePair<string, string> keyValuePair in (IEnumerable<KeyValuePair<string, string>>)context.Properties.Dictionary)
         context.AdditionalResponseParameters.Add(keyValuePair.Key, (object)keyValuePair.Value);
     return (Task)Task.FromResult<object>((object)null);
 }
开发者ID:quangnc0503h,项目名称:ecommerce,代码行数:6,代码来源:CaptchaOAuthProvider.cs


注:本文中的Microsoft.Owin.Security.OAuth.OAuthTokenEndpointContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。