From 6ae37717e819b047b10421e997e9704601d9fbd9 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 25 Jun 2015 19:47:11 -0700 Subject: [PATCH] Delete super dead code --- .../AuthenticationTokenCreateContext.cs | 40 ---------- .../AuthenticationTokenProvider.cs | 74 ------------------- .../AuthenticationTokenReceiveContext.cs | 29 -------- .../IAuthenticationTokenProvider.cs | 16 ---- 4 files changed, 159 deletions(-) delete mode 100644 src/Microsoft.AspNet.Authentication/AuthenticationTokenCreateContext.cs delete mode 100644 src/Microsoft.AspNet.Authentication/AuthenticationTokenProvider.cs delete mode 100644 src/Microsoft.AspNet.Authentication/AuthenticationTokenReceiveContext.cs delete mode 100644 src/Microsoft.AspNet.Authentication/IAuthenticationTokenProvider.cs diff --git a/src/Microsoft.AspNet.Authentication/AuthenticationTokenCreateContext.cs b/src/Microsoft.AspNet.Authentication/AuthenticationTokenCreateContext.cs deleted file mode 100644 index ae0548f763..0000000000 --- a/src/Microsoft.AspNet.Authentication/AuthenticationTokenCreateContext.cs +++ /dev/null @@ -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 _secureDataFormat; - - public AuthenticationTokenCreateContext( - [NotNull] HttpContext context, - [NotNull] ISecureDataFormat 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; - } - } -} diff --git a/src/Microsoft.AspNet.Authentication/AuthenticationTokenProvider.cs b/src/Microsoft.AspNet.Authentication/AuthenticationTokenProvider.cs deleted file mode 100644 index 9483538c6f..0000000000 --- a/src/Microsoft.AspNet.Authentication/AuthenticationTokenProvider.cs +++ /dev/null @@ -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 OnCreate { get; set; } - public Func OnCreateAsync { get; set; } - public Action OnReceive { get; set; } - public Func 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); - } - } - } -} diff --git a/src/Microsoft.AspNet.Authentication/AuthenticationTokenReceiveContext.cs b/src/Microsoft.AspNet.Authentication/AuthenticationTokenReceiveContext.cs deleted file mode 100644 index ec0c38b209..0000000000 --- a/src/Microsoft.AspNet.Authentication/AuthenticationTokenReceiveContext.cs +++ /dev/null @@ -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; - } - } -} diff --git a/src/Microsoft.AspNet.Authentication/IAuthenticationTokenProvider.cs b/src/Microsoft.AspNet.Authentication/IAuthenticationTokenProvider.cs deleted file mode 100644 index 3315fa21f1..0000000000 --- a/src/Microsoft.AspNet.Authentication/IAuthenticationTokenProvider.cs +++ /dev/null @@ -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); - } -}