forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.cshtml
More file actions
154 lines (124 loc) · 3.89 KB
/
Copy pathdefault.cshtml
File metadata and controls
154 lines (124 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@using ServiceStack
@using ServiceStack.Auth
@using ServiceStack.OrmLite
<script>
var $id = function(id) { return document.getElementById(id); };
</script>
<style>
body {
font-family: Arial;
}
</style>
<h2>Auth Data</h2>
<div id="authadata" class="jsonviewer">
<h3>Session</h3>
<div id="session"></div>
<h3>User Auth</h3>
<div id="userAuth"></div>
<h3>Auth Providers</h3>
<div id="authProviders"></div>
@{
var session = base.SessionAs<CustomUserSession>();
if (session.IsAuthenticated)
{
//requires using OrmLiteAuthRepository
var userAuthId = session.UserAuthId.ToInt();
var userAuth = Db.SingleById<UserAuth>(userAuthId);
var authProviders = Db.Select<UserAuthDetails>(x => x.UserAuthId == userAuthId);
<h2 style="color:green">Authenticated!</h2>
<script>
$id("session").innerHTML = jsonviewer(@session.AsRawJson());
$id("userAuth").innerHTML = jsonviewer(@userAuth.AsRawJson());
$id("authProviders").innerHTML = jsonviewer(@authProviders.AsRawJson());
</script>
}
else
{
<h2 style="color:red">Not Authenticated</h2>
}
}
</div>
<h2>Login with Auth Providers</h2>
<div id="login">
<div>
<h2>Twitter</h2>
<a href="/auth/twitter">/auth/twitter</a>
</div>
<div>
<h2>Facebook</h2>
<a href="/auth/facebook">/auth/facebook</a>
</div>
<div>
<h2>Google OpenId</h2>
<a href="/auth/GoogleOpenId">/auth/GoogleOpenId</a>
</div>
<div>
<h2>Yahoo</h2>
<a href="/auth/YahooOpenId">/auth/YahooOpenId</a>
</div>
<div>
<h2>Google OAuth</h2>
<a href="/auth/GoogleOAuth">/auth/GoogleOAuth</a>
</div>
<div>
<h2>LinkedIn</h2>
<a href="/auth/LinkedIn">/auth/LinkedIn</a>
</div>
<div>
<h2>GitHub</h2>
<a href="/auth/github">/auth/github</a>
</div>
<div>
<h2>Yandex</h2>
<a href="/auth/Yandex">/auth/Yandex</a>
</div>
<div>
<h2>VK.com</h2>
<a href="/auth/vkcom">/auth/vkcom</a>
</div>
<div>
<h2>Odnoklassniki.ru</h2>
<a href="/auth/Odnoklassniki">/auth/Odnoklassniki</a>
</div>
<div>
<h2>Windows Auth</h2>
<a href="/auth/windowsauth">/auth/windowsauth</a>
</div>
<h3>Custom Credentials Auth</h3>
<form action="/auth/credentials">
<input type="text" name="Username" value="demis.bellot@gmail.com"/>
<input type="text" name="Password" value="test"/>
<input type="submit"/>
</form>
<h3>Register New User</h3>
<form action="/register" method="POST">
<input type="text" name="Username" placeholder="UserName" value="NewUser"/>
<input type="text" name="Password" placeholder="Password" value="test"/>
<input type="text" name="FirstName" placeholder="FirstName" value="New"/>
<input type="text" name="LastName" placeholder="LastName" value="User"/>
<input type="submit"/>
</form>
<hr/>
<h3>Reset UserAuth tables and Session</h3>
<a href="/reset-userauth">/reset-userauth</a>
<h3>Lock all Users</h3>
<a href="/lockallusers">/lockallusers</a>
<h3>Logout</h3>
<a href="/auth/logout">/auth/logout</a>
</div>
<h2>All AuthProviders</h2>
<div id="allauthproviders" class="jsonviewer">
<h3>All User Auths</h3>
<div id="allUserAuths"></div>
<h3>All Auth Providers</h3>
<div id="allAuthProviders"></div>
@{
//requires using OrmLiteAuthRepository
var allUserAuths = Db.Select<UserAuth>();
var allAuthProviders = Db.Select<UserAuthDetails>();
<script>
$id("allUserAuths").innerHTML = jsonviewer(@allUserAuths.AsRawJson());
$id("allAuthProviders").innerHTML = jsonviewer(@allAuthProviders.AsRawJson());
</script>
}
</div>