本文整理汇总了C#中IServiceCollection.AddStormpath方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceCollection.AddStormpath方法的具体用法?C# IServiceCollection.AddStormpath怎么用?C# IServiceCollection.AddStormpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceCollection
的用法示例。
在下文中一共展示了IServiceCollection.AddStormpath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add Stormpath services
var stormpathConfiguration = new StormpathConfiguration()
{
Web = new WebConfiguration()
{
ServerUri = "http://localhost:8080",
Login = new WebLoginRouteConfiguration()
//{
// View = "~/Views/Stormpath/MyLogin.cshtml"
//}
}
};
services.AddStormpath(stormpathConfiguration);
// Configure authorization policies here, which can include Stormpath requirements.
services.AddAuthorization(opt =>
{
opt.AddPolicy("CustomDataIT", policy => policy.AddRequirements(new StormpathCustomDataRequirement("testing", "rocks!")));
opt.AddPolicy("AdminITGroup", policy => policy.AddRequirements(new StormpathGroupsRequirement("adminIT")));
});
// Add framework services.
services.AddMvc();
}
示例2: ConfigureServices_CustomView
public void ConfigureServices_CustomView(IServiceCollection services)
{
#region code/templates/aspnetcore/custom_view.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Login = new WebLoginRouteConfiguration
{
View = "~/Views/Login/MyLogin.cshtml"
}
}
});
#endregion
}
示例3: ConfigureServices_AnonymousModel
public void ConfigureServices_AnonymousModel(IServiceCollection services)
{
#region code/configuration/aspnetcore/anonymous_inline_config.cs
services.AddStormpath(new
{
application = new
{
name = "My Application"
},
web = new
{
register = new
{
enabled = false
}
}
});
#endregion
}
示例4: ConfigureServices_Model
public void ConfigureServices_Model(IServiceCollection services)
{
#region code/configuration/aspnetcore/inline_config.cs
services.AddStormpath(new StormpathConfiguration()
{
Application = new ApplicationConfiguration()
{
Name = "My Application"
},
Web = new WebConfiguration()
{
Register = new WebRegisterRouteConfiguration()
{
Enabled = false
}
}
});
#endregion
}
示例5: ConfigureServices_RegisterCustomFormField
public void ConfigureServices_RegisterCustomFormField(IServiceCollection services)
{
#region code/registration/aspnetcore/configure_custom_form_field.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Register = new WebRegisterRouteConfiguration
{
Form = new WebRegisterRouteFormConfiguration
{
Fields = new Dictionary<string, WebFieldConfiguration>
{
["favoriteColor"] = new WebFieldConfiguration
{
Enabled = true,
Visible = true,
Label = "Favorite Color",
Placeholder = "e.g. red, blue",
Required = true,
Type = "text"
}
}
}
}
}
});
#endregion
}
示例6: ConfigureServices_RegisterFormFieldsRequired
public void ConfigureServices_RegisterFormFieldsRequired(IServiceCollection services)
{
#region code/registration/aspnetcore/configure_form_fields_required.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Register = new WebRegisterRouteConfiguration
{
Form = new WebRegisterRouteFormConfiguration
{
Fields = new Dictionary<string, WebFieldConfiguration>
{
["givenName"] = new WebFieldConfiguration { Required = false },
["surname"] = new WebFieldConfiguration { Required = false }
}
}
}
}
});
#endregion
}
示例7: ConfigureServices_RegisterUri
public void ConfigureServices_RegisterUri(IServiceCollection services)
{
#region code/registration/aspnetcore/configure_uri.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Register = new WebRegisterRouteConfiguration
{
Uri = "/createAccount"
}
}
});
#endregion
}
示例8: ConfigureServices_PasswordResetUris
public void ConfigureServices_PasswordResetUris(IServiceCollection services)
{
#region code/password_reset/aspnetcore/configure_uris.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
ForgotPassword = new WebForgotPasswordRouteConfiguration
{
Uri = "/forgot-password"
},
ChangePassword = new WebChangePasswordRouteConfiguration
{
Uri = "/change-password"
}
}
});
#endregion
}
示例9: ConfigureServices_LogoutUris
public void ConfigureServices_LogoutUris(IServiceCollection services)
{
#region code/logout/aspnetcore/configure_uris.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Logout = new WebLogoutRouteConfiguration
{
Uri = "/logMeOut",
NextUri = "/goodbye"
}
}
});
#endregion
}
示例10: ConfigureServices_LoginChangeLabel
public void ConfigureServices_LoginChangeLabel(IServiceCollection services)
{
#region code/login/aspnetcore/configure_labels.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Login = new WebLoginRouteConfiguration
{
Form = new WebLoginRouteFormConfiguration
{
Fields = new Dictionary<string, WebFieldConfiguration>
{
["login"] = new WebFieldConfiguration
{
Label = "Email",
Placeholder = "[email protected]"
},
["password"] = new WebFieldConfiguration
{
Placeholder = "Tip: Use a strong password!"
}
}
}
}
}
});
#endregion
}
示例11: ConfigureServices_LoginUri
public void ConfigureServices_LoginUri(IServiceCollection services)
{
#region code/login/aspnetcore/configure_uri.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Login = new WebLoginRouteConfiguration
{
Uri = "/logMeIn"
}
}
});
#endregion
}
示例12: ConfigureServices_VerifyEmailUri
public void ConfigureServices_VerifyEmailUri(IServiceCollection services)
{
#region code/email_verification/aspnetcore/configure_uri.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
VerifyEmail = new WebVerifyEmailRouteConfiguration
{
Uri = "/verifyEmail"
}
}
});
#endregion
}
示例13: ConfigureServices_ServerUri
public void ConfigureServices_ServerUri(IServiceCollection services)
{
#region code/configuration/aspnetcore/server_uri.cs
services.AddStormpath(new StormpathConfiguration()
{
Web = new WebConfiguration()
{
ServerUri = "http://localhost:5000"
}
});
#endregion
}
示例14: ConfigureServices_DisableHtml
public void ConfigureServices_DisableHtml(IServiceCollection services)
{
#region code/configuration/aspnetcore/disable_html_produces.cs
services.AddStormpath(new StormpathConfiguration()
{
Web = new WebConfiguration()
{
Produces = new string[] { "application/json" }
}
});
#endregion
}
示例15: ConfigureServices_RegisterFieldOrder
public void ConfigureServices_RegisterFieldOrder(IServiceCollection services)
{
#region code/registration/aspnetcore/configure_field_order.cs
services.AddStormpath(new StormpathConfiguration
{
Web = new WebConfiguration
{
Register = new WebRegisterRouteConfiguration
{
Form = new WebRegisterRouteFormConfiguration
{
FieldOrder = new string[]
{
"surname",
"givenName",
"email",
"password"
}
}
}
}
});
#endregion
}