本文整理汇总了C#中PathString类的典型用法代码示例。如果您正苦于以下问题:C# PathString类的具体用法?C# PathString怎么用?C# PathString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathString类属于命名空间,在下文中一共展示了PathString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LDAPAuthenticationOptions
//TODO: Include/exclude lists for claims?
public LDAPAuthenticationOptions()
: base(LDAPAuthenticationDefaults.AuthenticationType)
{
AntiForgeryCookieName = AntiForgeryConfig.CookieName;
AntiForgeryFieldName = LDAPAuthenticationDefaults.AntiForgeryFieldName;
AuthenticationMode = AuthenticationMode.Active;
CallbackPath = new PathString("/signin-activedirectoryldap");
Caption = LDAPAuthenticationDefaults.Caption;
ClaimTypes = new List<string>();//defaults?
DomainKey = LDAPAuthenticationDefaults.DomainKey;
//Domains = new List<DomainCredential>();
PasswordKey = LDAPAuthenticationDefaults.PasswordKey;
ReturnUrlParameter = LDAPAuthenticationDefaults.ReturnUrlParameter;
StateKey = LDAPAuthenticationDefaults.StateKey;
UsernameKey = LDAPAuthenticationDefaults.UsernameKey;
ValidateAntiForgeryToken = true;
RequiredClaims = new ReadOnlyCollection<string>(new List<string>
{
AntiForgeryConfig.UniqueClaimTypeIdentifier,
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType,
ClaimTypesAD.DisplayName,
ClaimTypesAD.Domain,
ClaimTypesAD.Guid,
System.Security.Claims.ClaimTypes.NameIdentifier,
System.Security.Claims.ClaimTypes.PrimarySid
});
}
开发者ID:blinds52,项目名称:Owin.Security.ActiveDirectoryLDAP,代码行数:30,代码来源:LDAPAuthenticationOptions.cs
示例2: BuildAbsolute
/// <summary>
/// Combines the given URI components into a string that is properly encoded for use in HTTP headers.
/// Note that unicode in the HostString will be encoded as punycode.
/// </summary>
/// <param name="scheme">http, https, etc.</param>
/// <param name="host">The host portion of the uri normally included in the Host header. This may include the port.</param>
/// <param name="pathBase">The first portion of the request path associated with application root.</param>
/// <param name="path">The portion of the request path that identifies the requested resource.</param>
/// <param name="query">The query, if any.</param>
/// <param name="fragment">The fragment, if any.</param>
/// <returns></returns>
public static string BuildAbsolute(
string scheme,
HostString host,
PathString pathBase = new PathString(),
PathString path = new PathString(),
QueryString query = new QueryString(),
FragmentString fragment = new FragmentString())
{
var combinedPath = (pathBase.HasValue || path.HasValue) ? (pathBase + path).ToString() : "/";
var encodedHost = host.ToString();
var encodedQuery = query.ToString();
var encodedFragment = fragment.ToString();
// PERF: Calculate string length to allocate correct buffer size for StringBuilder.
var length = scheme.Length + SchemeDelimiter.Length + encodedHost.Length
+ combinedPath.Length + encodedQuery.Length + encodedFragment.Length;
return new StringBuilder(length)
.Append(scheme)
.Append(SchemeDelimiter)
.Append(encodedHost)
.Append(combinedPath)
.Append(encodedQuery)
.Append(encodedFragment)
.ToString();
}
开发者ID:tuespetre,项目名称:HttpAbstractions,代码行数:38,代码来源:UriHelper.cs
示例3: StaticFileContext
public StaticFileContext(HttpContext context, StaticFileOptions options, PathString matchUrl)
{
_context = context;
_options = options;
_matchUrl = matchUrl;
_request = context.Request;
_response = context.Response;
_method = null;
_isGet = false;
_isHead = false;
_subPath = PathString.Empty;
_contentType = null;
_fileInfo = null;
_length = 0;
_lastModified = new DateTime();
_etag = null;
_etagQuoted = null;
_lastModifiedString = null;
_ifMatchState = PreconditionState.Unspecified;
_ifNoneMatchState = PreconditionState.Unspecified;
_ifModifiedSinceState = PreconditionState.Unspecified;
_ifUnmodifiedSinceState = PreconditionState.Unspecified;
_ranges = null;
}
开发者ID:WillSullivan,项目名称:StaticFiles,代码行数:25,代码来源:StaticFileContext.cs
示例4: WinAuthenticationOptions
public WinAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
Description.Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/windowsAuth");
AuthenticationMode = AuthenticationMode.Active;
}
开发者ID:DSilence,项目名称:WinodwsAuthenticationOwinMiddleware,代码行数:7,代码来源:WinAuthenticationOptions.cs
示例5: Map
/// <summary>
/// Branches the request pipeline based on matches of the given request path. If the request path starts with
/// the given path, the branch is executed.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
/// <param name="pathMatch">The request path to match.</param>
/// <param name="configuration">The branch to take for positive path matches.</param>
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
public static IApplicationBuilder Map(this IApplicationBuilder app, PathString pathMatch, Action<IApplicationBuilder> configuration)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
if (pathMatch.HasValue && pathMatch.Value.EndsWith("/", StringComparison.Ordinal))
{
throw new ArgumentException("The path must not end with a '/'", nameof(pathMatch));
}
// create branch
var branchBuilder = app.New();
configuration(branchBuilder);
var branch = branchBuilder.Build();
var options = new MapOptions
{
Branch = branch,
PathMatch = pathMatch,
};
return app.Use(next => new MapMiddleware(next, options).Invoke);
}
开发者ID:tuespetre,项目名称:HttpAbstractions,代码行数:37,代码来源:MapExtensions.cs
示例6: UseStatusNamePagesWithReExecute
/// <summary>
/// Adds a StatusCodePages middle-ware to the pipeline. Specifies that the response body should be generated by
/// re-executing the request pipeline using an alternate path. This path may contain a '{0}' placeholder of the
/// status code and a '{1}' placeholder of the status name.
/// </summary>
/// <param name="application">The application.</param>
/// <param name="pathFormat">The string representing the path to the error page. This path may contain a '{0}'
/// placeholder of the status code and a '{1}' placeholder of the status description.</param>
/// <returns>The application.</returns>
public static IApplicationBuilder UseStatusNamePagesWithReExecute(
this IApplicationBuilder application,
string pathFormat)
{
return application.UseStatusCodePages(
async context =>
{
var statusCode = context.HttpContext.Response.StatusCode;
var status = (HttpStatusCode)context.HttpContext.Response.StatusCode;
var newPath = new PathString(string.Format(
CultureInfo.InvariantCulture,
pathFormat,
statusCode,
status.ToString()));
var originalPath = context.HttpContext.Request.Path;
// Store the original paths so the application can check it.
context.HttpContext.SetFeature<IStatusCodeReExecuteFeature>(new StatusCodeReExecuteFeature()
{
OriginalPathBase = context.HttpContext.Request.PathBase.Value,
OriginalPath = originalPath.Value,
});
context.HttpContext.Request.Path = newPath;
try
{
await context.Next(context.HttpContext);
}
finally
{
context.HttpContext.Request.Path = originalPath;
context.HttpContext.SetFeature<IStatusCodeReExecuteFeature>(null);
}
});
}
开发者ID:CarlosHAraujo,项目名称:ASP.NET-MVC-Boilerplate,代码行数:44,代码来源:ApplicationBuilderExtensions.cs
示例7: WSO2AuthenticationOptions
public WSO2AuthenticationOptions() : base(Constants.DefaultAuthenticationType)
{
Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/signin-wso2");
AuthenticationMode = AuthenticationMode.Passive;
BackchannelTimeout = TimeSpan.FromSeconds(60);
}
开发者ID:TerribleDev,项目名称:OwinOAuthProviders,代码行数:7,代码来源:WSO2AuthenticationOptions.cs
示例8: KentorAuthServicesAuthenticationOptions
public KentorAuthServicesAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
AuthenticationMode = AuthenticationMode.Passive;
Description.Caption = Constants.DefaultCaption;
MetadataPath = new PathString(Constants.DefaultMetadataPath);
}
开发者ID:dmarlow,项目名称:authservices,代码行数:7,代码来源:KentorAuthServicesAuthenticationOptions.cs
示例9: RulesEndpoint
public RulesEndpoint(
IRuleData ruleData)
{
_ruleData = ruleData;
_draftRulesPath = new PathString("/rules");
_versionRulesPath = new PathString("/rules/{version}");
}
开发者ID:Bikeman868,项目名称:Urchin,代码行数:7,代码来源:RulesEndpoint.cs
示例10: LowCalorieAuthenticationServerOptions
public LowCalorieAuthenticationServerOptions()
: base("LowCalorieAuthentication")
{
this.AuthenticationMode = AuthenticationMode.Passive;
TokenEndpointPath = new PathString("/token2");
GernerateLocalToken = false;
}
开发者ID:jzoss,项目名称:LowCalorieOwin,代码行数:7,代码来源:LowCalorieAuthenticationServerOptions.cs
示例11: Test
public TestRunner Test(Func<HttpContext, Func<Task>, Task> test)
{
var path = new PathString("/test");
actions[path] = test;
return this;
}
开发者ID:Sefirosu,项目名称:accounting,代码行数:7,代码来源:TestRunner.cs
示例12: Setup
public TestRunner Setup(Func<HttpContext, Func<Task>, Task> setup)
{
var path = new PathString("/setup");
actions[path] = setup;
return this;
}
开发者ID:Sefirosu,项目名称:accounting,代码行数:7,代码来源:TestRunner.cs
示例13: GetSecuritiesAsync
public static async Task<SecurityCollection> GetSecuritiesAsync(this IMarketsFeature feature, string value) {
var path = new PathString("/v1/markets/search").Add(new {
q = value
});
return await feature.Client.GetAsync<SecurityCollection>(path);
}
开发者ID:migrap,项目名称:Tradier,代码行数:7,代码来源:MarketsFeatureExtensions.cs
示例14: OpenIdConnectOptions
public OpenIdConnectOptions(string authenticationScheme)
{
AuthenticationScheme = authenticationScheme;
DisplayName = OpenIdConnectDefaults.Caption;
CallbackPath = new PathString("/signin-oidc");
Events = new OpenIdConnectEvents();
}
开发者ID:leloulight,项目名称:Security,代码行数:7,代码来源:OpenIdConnectOptions.cs
示例15: SteamAuthenticationOptions
public SteamAuthenticationOptions()
{
ProviderDiscoveryUri = "http://steamcommunity.com/openid/";
Caption = "Steam";
AuthenticationType = "Steam";
CallbackPath = new PathString("/signin-openidsteam");
}
开发者ID:uhavemyword,项目名称:OwinOAuthProviders,代码行数:7,代码来源:SteamAuthenticationOptions.cs
示例16: NestAuthenticationOptions
public NestAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
Description.Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/ExternalLoginCallback");
AuthenticationMode = AuthenticationMode.Passive;
}
开发者ID:rjester,项目名称:NestFun,代码行数:7,代码来源:NestAuthenticationOptions.cs
示例17: TestEndpoint
public TestEndpoint(
IRuleData ruleData)
{
_ruleData = ruleData;
_draftVersionPath = new PathString("/test");
_versionPath = new PathString("/test/{version}");
}
开发者ID:Bikeman868,项目名称:Urchin,代码行数:7,代码来源:TestEndpoint.cs
示例18: ConfigureAuth
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Configure the application for OAuth based flow
PublicClientId = "MxRblSync.Api";
OAuthAuthorizationOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Authenticate"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
Provider = new ApiAuthorizationProvider(
_loginSessionRepository,
_authKeyRepository,
_userRepository,
_hashingService,
PublicClientId),
#if DEBUG
AllowInsecureHttp = true
#else
AllowInsecureHttp = false
#endif
};
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthAuthorizationServer(OAuthAuthorizationOptions);
OAuthAuthenticationOptions = new OAuthBearerAuthenticationOptions
{
Provider = new ApiAuthenticationProvider(_authKeyRepository)
};
app.UseOAuthBearerAuthentication(OAuthAuthenticationOptions);
}
开发者ID:magonzalez,项目名称:WebApi-OAuth2-StarterKit,代码行数:32,代码来源:ApiOwinAuthConfig.cs
示例19: GetVirtualPath_ReturnsDataTokens
public void GetVirtualPath_ReturnsDataTokens(RouteValueDictionary dataTokens, string routerName)
{
// Arrange
var virtualPath = new PathString("/TestVirtualPath");
var pathContextValues = new RouteValueDictionary { { "controller", virtualPath } };
var pathContext = CreateVirtualPathContext(
pathContextValues,
GetRouteOptions(),
routerName);
var route = CreateTemplateRoute("{controller}", routerName, dataTokens);
var routeCollection = new RouteCollection();
routeCollection.Add(route);
var expectedDataTokens = dataTokens ?? new RouteValueDictionary();
// Act
var pathData = routeCollection.GetVirtualPath(pathContext);
// Assert
Assert.NotNull(pathData);
Assert.Same(route, pathData.Router);
Assert.Equal(virtualPath, pathData.VirtualPath);
Assert.Equal(expectedDataTokens.Count, pathData.DataTokens.Count);
foreach (var dataToken in expectedDataTokens)
{
Assert.True(pathData.DataTokens.ContainsKey(dataToken.Key));
Assert.Equal(dataToken.Value, pathData.DataTokens[dataToken.Key]);
}
}
开发者ID:nbilling,项目名称:Routing,代码行数:34,代码来源:RouteCollectionTest.cs
示例20: UseSpa
/// <summary>
/// Enables static file serving for the given request path
///
/// </summary>
/// <param name="builder"/>
/// <param name="defaultHtml">The default html to serve.</param>
/// <returns/>
public static IApplicationBuilder UseSpa(this IApplicationBuilder builder, string defaultHtml)
{
var options = new SpaOptions();
var pathString = new PathString(defaultHtml);
options.DefaultHtml = pathString;
return builder.UseSpa(options);
}
开发者ID:cloudmark,项目名称:Spa.Extensions,代码行数:14,代码来源:SpaExtensions.cs
注:本文中的PathString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论