-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAzureAuthentication.cs
63 lines (59 loc) · 1.92 KB
/
AzureAuthentication.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assets.Scripts.CloudBread
{
class AzureAuthentication
{
public class AuthenticationToken
{
}
public class FacebookGoogleAuthenticationToken : AuthenticationToken
{
public string access_token;
}
public class MicrosoftAuthenticationToken : AuthenticationToken
{
public string authenticationToken;
}
public enum AuthenticationProvider
{
// Summary:
// Microsoft Account authentication provider.
MicrosoftAccount = 0,
//
// Summary:
// Google authentication provider.
Google = 1,
//
// Summary:
// Twitter authentication provider.
Twitter = 2,
//
// Summary:
// Facebook authentication provider.
Facebook = 3,
}
public static AuthenticationToken CreateToken(AuthenticationProvider provider, string token)
{
AuthenticationToken authToken = new AuthenticationToken();
switch (provider)
{
case AuthenticationProvider.Facebook:
case AuthenticationProvider.Google:
case AuthenticationProvider.Twitter:
{
authToken = new FacebookGoogleAuthenticationToken() { access_token = token };
break;
}
case AuthenticationProvider.MicrosoftAccount:
{
authToken = new MicrosoftAuthenticationToken() { authenticationToken = token };
break;
}
}
return authToken;
}
}
}