diff options
Diffstat (limited to 'OpenSim/Framework/General/AuthenticateSessionBase.cs')
-rw-r--r-- | OpenSim/Framework/General/AuthenticateSessionBase.cs | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/OpenSim/Framework/General/AuthenticateSessionBase.cs b/OpenSim/Framework/General/AuthenticateSessionBase.cs index 71616e3..2d02286 100644 --- a/OpenSim/Framework/General/AuthenticateSessionBase.cs +++ b/OpenSim/Framework/General/AuthenticateSessionBase.cs | |||
@@ -1,130 +1,130 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | 30 | using OpenSim.Framework.Interfaces; |
31 | using OpenSim.Framework.Types; | 31 | using OpenSim.Framework.Types; |
32 | 32 | ||
33 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
34 | { | 34 | { |
35 | public class AuthenticateSessionsBase | 35 | public class AuthenticateSessionsBase |
36 | { | 36 | { |
37 | public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | 37 | public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); |
38 | 38 | ||
39 | public AuthenticateSessionsBase() | 39 | public AuthenticateSessionsBase() |
40 | { | 40 | { |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | 44 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) |
45 | { | 45 | { |
46 | AgentCircuitData validcircuit = null; | 46 | AgentCircuitData validcircuit = null; |
47 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 47 | if (this.AgentCircuits.ContainsKey(circuitcode)) |
48 | { | 48 | { |
49 | validcircuit = this.AgentCircuits[circuitcode]; | 49 | validcircuit = this.AgentCircuits[circuitcode]; |
50 | } | 50 | } |
51 | AuthenticateResponse user = new AuthenticateResponse(); | 51 | AuthenticateResponse user = new AuthenticateResponse(); |
52 | if (validcircuit == null) | 52 | if (validcircuit == null) |
53 | { | 53 | { |
54 | //don't have this circuit code in our list | 54 | //don't have this circuit code in our list |
55 | user.Authorised = false; | 55 | user.Authorised = false; |
56 | return (user); | 56 | return (user); |
57 | } | 57 | } |
58 | 58 | ||
59 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | 59 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) |
60 | { | 60 | { |
61 | user.Authorised = true; | 61 | user.Authorised = true; |
62 | user.LoginInfo = new Login(); | 62 | user.LoginInfo = new Login(); |
63 | user.LoginInfo.Agent = agentID; | 63 | user.LoginInfo.Agent = agentID; |
64 | user.LoginInfo.Session = sessionID; | 64 | user.LoginInfo.Session = sessionID; |
65 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; | 65 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; |
66 | user.LoginInfo.First = validcircuit.firstname; | 66 | user.LoginInfo.First = validcircuit.firstname; |
67 | user.LoginInfo.Last = validcircuit.lastname; | 67 | user.LoginInfo.Last = validcircuit.lastname; |
68 | user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; | 68 | user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; |
69 | user.LoginInfo.BaseFolder = validcircuit.BaseFolder; | 69 | user.LoginInfo.BaseFolder = validcircuit.BaseFolder; |
70 | } | 70 | } |
71 | else | 71 | else |
72 | { | 72 | { |
73 | // Invalid | 73 | // Invalid |
74 | user.Authorised = false; | 74 | user.Authorised = false; |
75 | } | 75 | } |
76 | 76 | ||
77 | return (user); | 77 | return (user); |
78 | } | 78 | } |
79 | 79 | ||
80 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) | 80 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) |
81 | { | 81 | { |
82 | if (this.AgentCircuits.ContainsKey(circuitCode)) | 82 | if (this.AgentCircuits.ContainsKey(circuitCode)) |
83 | { | 83 | { |
84 | this.AgentCircuits[circuitCode] = agentData; | 84 | this.AgentCircuits[circuitCode] = agentData; |
85 | } | 85 | } |
86 | else | 86 | else |
87 | { | 87 | { |
88 | this.AgentCircuits.Add(circuitCode, agentData); | 88 | this.AgentCircuits.Add(circuitCode, agentData); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | public LLVector3 GetPosition(uint circuitCode) | 92 | public LLVector3 GetPosition(uint circuitCode) |
93 | { | 93 | { |
94 | LLVector3 vec = new LLVector3(); | 94 | LLVector3 vec = new LLVector3(); |
95 | if (this.AgentCircuits.ContainsKey(circuitCode)) | 95 | if (this.AgentCircuits.ContainsKey(circuitCode)) |
96 | { | 96 | { |
97 | vec = this.AgentCircuits[circuitCode].startpos; | 97 | vec = this.AgentCircuits[circuitCode].startpos; |
98 | } | 98 | } |
99 | return vec; | 99 | return vec; |
100 | } | 100 | } |
101 | 101 | ||
102 | public void UpdateAgentData(AgentCircuitData agentData) | 102 | public void UpdateAgentData(AgentCircuitData agentData) |
103 | { | 103 | { |
104 | if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) | 104 | if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) |
105 | { | 105 | { |
106 | this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; | 106 | this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; |
107 | this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; | 107 | this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; |
108 | this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; | 108 | this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; |
109 | // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); | 109 | // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) | 113 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) |
114 | { | 114 | { |
115 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 115 | if (this.AgentCircuits.ContainsKey(circuitcode)) |
116 | { | 116 | { |
117 | this.AgentCircuits[circuitcode].child = childstatus; | 117 | this.AgentCircuits[circuitcode].child = childstatus; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | public bool GetAgentChildStatus(uint circuitcode) | 121 | public bool GetAgentChildStatus(uint circuitcode) |
122 | { | 122 | { |
123 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 123 | if (this.AgentCircuits.ContainsKey(circuitcode)) |
124 | { | 124 | { |
125 | return this.AgentCircuits[circuitcode].child; | 125 | return this.AgentCircuits[circuitcode].child; |
126 | } | 126 | } |
127 | return false; | 127 | return false; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } \ No newline at end of file | 130 | } \ No newline at end of file |