Mercurial > silverbladetech
annotate SilverlightExampleApp/SilverlightExampleApp.Web/Services/AuthenticationService.svc.cs @ 56:cb646712bc97
Class diagram added
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Thu, 19 Apr 2012 14:14:45 +0100 |
parents | 502f5f365649 |
children |
rev | line source |
---|---|
49
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System.ServiceModel; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using System.ServiceModel.Activation; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using System.Web.Security; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 namespace SilverlightExampleApp.Web.Services |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 [ServiceContract(Namespace = "")] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 [SilverlightFaultBehavior] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 public class AuthenticationService |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 public bool Authenticate(string username, string password) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 if (ValidateLogin(username, password)) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 FormsAuthentication.SetAuthCookie(username, false); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 return true; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 return false; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 [OperationContract] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 public bool LogOut() |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 FormsAuthentication.SignOut(); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 return true; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 public bool ValidateLogin(string username, string password) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 return username == "stevenh" && password == "password"; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 } |