Skip to content

Commit e81cc90

Browse files
Remove dead code
1 parent 52ef4a7 commit e81cc90

File tree

2 files changed

+44
-51
lines changed

2 files changed

+44
-51
lines changed
+15-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
using GenHTTP.Api.Protocol;
2-
3-
namespace GenHTTP.Modules.Authentication.Web
4-
{
5-
6-
public interface ISessionHandling
7-
{
8-
9-
string? ReadToken(IRequest request);
10-
11-
void WriteToken(IResponse response, string sessionToken);
12-
13-
void ClearToken(IResponse response);
14-
15-
}
16-
17-
}
1+
using GenHTTP.Api.Protocol;
2+
3+
namespace GenHTTP.Modules.Authentication.Web
4+
{
5+
6+
public interface ISessionHandling
7+
{
8+
9+
string? ReadToken(IRequest request);
10+
11+
void WriteToken(IResponse response, string sessionToken);
12+
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
1-
using GenHTTP.Api.Protocol;
2-
3-
namespace GenHTTP.Modules.Authentication.Web.Integration
4-
{
5-
6-
public class DefaultSessionHandling : ISessionHandling
7-
{
8-
private const string COOKIE_NAME = "wa_session";
9-
10-
private const ulong COOKIE_TIMEOUT = 2592000; // 30d
11-
12-
public string? ReadToken(IRequest request)
13-
{
14-
if (request.Cookies.TryGetValue(COOKIE_NAME, out var token))
15-
{
16-
return new(token.Value);
17-
}
18-
19-
return null;
20-
}
21-
22-
public void WriteToken(IResponse response, string sessionToken)
23-
{
24-
response.SetCookie(new(COOKIE_NAME, sessionToken, COOKIE_TIMEOUT));
25-
}
26-
27-
public void ClearToken(IResponse response)
28-
{
29-
response.SetCookie(new(COOKIE_NAME, string.Empty, 0));
30-
}
31-
32-
}
33-
34-
}
1+
using GenHTTP.Api.Protocol;
2+
3+
namespace GenHTTP.Modules.Authentication.Web.Integration
4+
{
5+
6+
public class DefaultSessionHandling : ISessionHandling
7+
{
8+
private const string COOKIE_NAME = "wa_session";
9+
10+
private const ulong COOKIE_TIMEOUT = 2592000; // 30d
11+
12+
public string? ReadToken(IRequest request)
13+
{
14+
if (request.Cookies.TryGetValue(COOKIE_NAME, out var token))
15+
{
16+
return new(token.Value);
17+
}
18+
19+
return null;
20+
}
21+
22+
public void WriteToken(IResponse response, string sessionToken)
23+
{
24+
response.SetCookie(new(COOKIE_NAME, sessionToken, COOKIE_TIMEOUT));
25+
}
26+
27+
}
28+
29+
}

0 commit comments

Comments
 (0)