diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Interfaces/IAuthorizationService.cs | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IAuthorizationService.cs b/OpenSim/Services/Interfaces/IAuthorizationService.cs new file mode 100644 index 0000000..e5c68f6 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAuthorizationService.cs | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | // Generic Authorization service used for authorizing principals in a particular region | ||
34 | |||
35 | public interface IAuthorizationService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Check whether the user should be given access to the region. | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// We also supply user first name and last name for situations where the user does not have an account | ||
42 | /// on the region (e.g. they're a visitor via Hypergrid). | ||
43 | /// </remarks> | ||
44 | /// <param name="userID"></param> | ||
45 | /// <param name="firstName">/param> | ||
46 | /// <param name="lastName"></param> | ||
47 | /// <param name="regionID"></param> | ||
48 | /// <param name="message"></param> | ||
49 | /// <returns></returns> | ||
50 | bool IsAuthorizedForRegion( | ||
51 | string userID, string firstName, string lastName, string regionID, out string message); | ||
52 | } | ||
53 | |||
54 | public class AuthorizationRequest | ||
55 | { | ||
56 | private string m_userID; | ||
57 | private string m_firstname; | ||
58 | private string m_surname; | ||
59 | private string m_email; | ||
60 | private string m_regionName; | ||
61 | private string m_regionID; | ||
62 | |||
63 | public AuthorizationRequest() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | public AuthorizationRequest(string ID, string RegionID) | ||
68 | { | ||
69 | m_userID = ID; | ||
70 | m_regionID = RegionID; | ||
71 | } | ||
72 | |||
73 | public AuthorizationRequest( | ||
74 | string ID, string FirstName, string SurName, string Email, string RegionName, string RegionID) | ||
75 | { | ||
76 | m_userID = ID; | ||
77 | m_firstname = FirstName; | ||
78 | m_surname = SurName; | ||
79 | m_email = Email; | ||
80 | m_regionName = RegionName; | ||
81 | m_regionID = RegionID; | ||
82 | } | ||
83 | |||
84 | public string ID | ||
85 | { | ||
86 | get { return m_userID; } | ||
87 | set { m_userID = value; } | ||
88 | } | ||
89 | |||
90 | public string FirstName | ||
91 | { | ||
92 | get { return m_firstname; } | ||
93 | set { m_firstname = value; } | ||
94 | } | ||
95 | |||
96 | public string SurName | ||
97 | { | ||
98 | get { return m_surname; } | ||
99 | set { m_surname = value; } | ||
100 | } | ||
101 | |||
102 | public string Email | ||
103 | { | ||
104 | get { return m_email; } | ||
105 | set { m_email = value; } | ||
106 | } | ||
107 | |||
108 | public string RegionName | ||
109 | { | ||
110 | get { return m_regionName; } | ||
111 | set { m_regionName = value; } | ||
112 | } | ||
113 | |||
114 | public string RegionID | ||
115 | { | ||
116 | get { return m_regionID; } | ||
117 | set { m_regionID = value; } | ||
118 | } | ||
119 | } | ||
120 | |||
121 | public class AuthorizationResponse | ||
122 | { | ||
123 | private bool m_isAuthorized; | ||
124 | private string m_message; | ||
125 | |||
126 | public AuthorizationResponse() | ||
127 | { | ||
128 | } | ||
129 | |||
130 | public AuthorizationResponse(bool isAuthorized, string message) | ||
131 | { | ||
132 | m_isAuthorized = isAuthorized; | ||
133 | m_message = message; | ||
134 | } | ||
135 | |||
136 | public bool IsAuthorized | ||
137 | { | ||
138 | get { return m_isAuthorized; } | ||
139 | set { m_isAuthorized = value; } | ||
140 | } | ||
141 | |||
142 | public string Message | ||
143 | { | ||
144 | get { return m_message; } | ||
145 | set { m_message = value; } | ||
146 | } | ||
147 | } | ||
148 | } \ No newline at end of file | ||