Delete super dead code
This commit is contained in:
parent
19d026268b
commit
6ae37717e8
|
|
@ -1,40 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Microsoft.AspNet.Http;
|
|
||||||
using Microsoft.AspNet.Authentication.Notifications;
|
|
||||||
using Microsoft.Framework.Internal;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Authentication
|
|
||||||
{
|
|
||||||
public class AuthenticationTokenCreateContext : BaseContext
|
|
||||||
{
|
|
||||||
private readonly ISecureDataFormat<AuthenticationTicket> _secureDataFormat;
|
|
||||||
|
|
||||||
public AuthenticationTokenCreateContext(
|
|
||||||
[NotNull] HttpContext context,
|
|
||||||
[NotNull] ISecureDataFormat<AuthenticationTicket> secureDataFormat,
|
|
||||||
[NotNull] AuthenticationTicket ticket)
|
|
||||||
: base(context)
|
|
||||||
{
|
|
||||||
_secureDataFormat = secureDataFormat;
|
|
||||||
Ticket = ticket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Token { get; protected set; }
|
|
||||||
|
|
||||||
public AuthenticationTicket Ticket { get; protected set; }
|
|
||||||
|
|
||||||
public string SerializeTicket()
|
|
||||||
{
|
|
||||||
return _secureDataFormat.Protect(Ticket);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetToken([NotNull] string tokenValue)
|
|
||||||
{
|
|
||||||
Token = tokenValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Authentication
|
|
||||||
{
|
|
||||||
public class AuthenticationTokenProvider : IAuthenticationTokenProvider
|
|
||||||
{
|
|
||||||
public Action<AuthenticationTokenCreateContext> OnCreate { get; set; }
|
|
||||||
public Func<AuthenticationTokenCreateContext, Task> OnCreateAsync { get; set; }
|
|
||||||
public Action<AuthenticationTokenReceiveContext> OnReceive { get; set; }
|
|
||||||
public Func<AuthenticationTokenReceiveContext, Task> OnReceiveAsync { get; set; }
|
|
||||||
|
|
||||||
public virtual void Create(AuthenticationTokenCreateContext context)
|
|
||||||
{
|
|
||||||
if (OnCreateAsync != null && OnCreate == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Resources.Exception_AuthenticationTokenDoesNotProvideSyncMethods);
|
|
||||||
}
|
|
||||||
if (OnCreate != null)
|
|
||||||
{
|
|
||||||
OnCreate.Invoke(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task CreateAsync(AuthenticationTokenCreateContext context)
|
|
||||||
{
|
|
||||||
if (OnCreateAsync != null && OnCreate == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Resources.Exception_AuthenticationTokenDoesNotProvideSyncMethods);
|
|
||||||
}
|
|
||||||
if (OnCreateAsync != null)
|
|
||||||
{
|
|
||||||
await OnCreateAsync.Invoke(context);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Create(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Receive(AuthenticationTokenReceiveContext context)
|
|
||||||
{
|
|
||||||
if (OnReceiveAsync != null && OnReceive == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Resources.Exception_AuthenticationTokenDoesNotProvideSyncMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OnReceive != null)
|
|
||||||
{
|
|
||||||
OnReceive.Invoke(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
|
|
||||||
{
|
|
||||||
if (OnReceiveAsync != null && OnReceive == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Resources.Exception_AuthenticationTokenDoesNotProvideSyncMethods);
|
|
||||||
}
|
|
||||||
if (OnReceiveAsync != null)
|
|
||||||
{
|
|
||||||
await OnReceiveAsync.Invoke(context);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Receive(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using Microsoft.AspNet.Http;
|
|
||||||
using Microsoft.AspNet.Authentication.Notifications;
|
|
||||||
using Microsoft.Framework.Internal;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Authentication
|
|
||||||
{
|
|
||||||
public class AuthenticationTokenReceiveContext : BaseContext
|
|
||||||
{
|
|
||||||
public AuthenticationTokenReceiveContext(
|
|
||||||
[NotNull] HttpContext context,
|
|
||||||
[NotNull] string token)
|
|
||||||
: base(context)
|
|
||||||
{
|
|
||||||
Token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Token { get; protected set; }
|
|
||||||
|
|
||||||
public AuthenticationTicket Ticket { get; protected set; }
|
|
||||||
|
|
||||||
public void SetTicket([NotNull] AuthenticationTicket ticket)
|
|
||||||
{
|
|
||||||
Ticket = ticket;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Authentication
|
|
||||||
{
|
|
||||||
public interface IAuthenticationTokenProvider
|
|
||||||
{
|
|
||||||
void Create(AuthenticationTokenCreateContext context);
|
|
||||||
Task CreateAsync(AuthenticationTokenCreateContext context);
|
|
||||||
void Receive(AuthenticationTokenReceiveContext context);
|
|
||||||
Task ReceiveAsync(AuthenticationTokenReceiveContext context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue