本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例11: TokenEndpoint
public Task TokenEndpoint(OAuthTokenEndpointContext context)
{
throw new NotImplementedException();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}