aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-03 19:49:26 +0000
committerMelanie Thielker2009-06-03 19:49:26 +0000
commit6e494e5de57d248e8c45d8a185d88fa06ee4b160 (patch)
tree707e62e7b23b1aa49d51f075567dadfb0b373734
parent* Making sure we fail a bit earlier if we have no AssetService (diff)
downloadopensim-SC-6e494e5de57d248e8c45d8a185d88fa06ee4b160.zip
opensim-SC-6e494e5de57d248e8c45d8a185d88fa06ee4b160.tar.gz
opensim-SC-6e494e5de57d248e8c45d8a185d88fa06ee4b160.tar.bz2
opensim-SC-6e494e5de57d248e8c45d8a185d88fa06ee4b160.tar.xz
Committing the partial refactor of authentication services. No user functionlity
will eat your babies, etc
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs61
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs2
-rw-r--r--OpenSim/Services/Interfaces/IAuthenticationService.cs27
3 files changed, 85 insertions, 5 deletions
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs
new file mode 100644
index 0000000..07dea4a
--- /dev/null
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs
@@ -0,0 +1,61 @@
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
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34
35namespace OpenSim.Server.Handlers.Authentication
36{
37 public class AuthenticationServiceConnector : ServiceConnector
38 {
39 private IAuthenticationService m_AuthenticationService;
40
41 public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) :
42 base(config, server)
43 {
44 IConfig serverConfig = config.Configs["AuthenticationService"];
45 if (serverConfig == null)
46 throw new Exception("No section 'Server' in config file");
47
48 string authenticationService = serverConfig.GetString("AuthenticationServiceModule",
49 String.Empty);
50
51 if (authenticationService == String.Empty)
52 throw new Exception("No AuthenticationService in config file");
53
54 Object[] args = new Object[] { config };
55 m_AuthenticationService =
56 ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
57
58 //server.AddStreamHandler(new AuthenticationServerGetHandler(m_AuthenticationService));
59 }
60 }
61}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 0d7a493..dd32ec9 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Server.Handlers.Simulation
108 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; 108 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
109 return result; 109 return result;
110 } 110 }
111 if (!m_AuthenticationService.VerifyKey(agentID, authToken)) 111 if (!m_AuthenticationService.VerifyUserKey(agentID, authToken))
112 { 112 {
113 m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); 113 m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path);
114 httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; 114 httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs
index 835b68f..35831c1 100644
--- a/OpenSim/Services/Interfaces/IAuthenticationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs
@@ -32,10 +32,29 @@ namespace OpenSim.Services.Interfaces
32{ 32{
33 public interface IAuthenticationService 33 public interface IAuthenticationService
34 { 34 {
35 string GetNewKey(UUID userID, UUID authToken); 35 // Create a new user session. If one exists, it is cleared
36 //
37 UUID AllocateUserSession(UUID userID);
36 38
37 bool VerifyKey(UUID userID, string key); 39 // Get a user key from an authentication token. This must be
38 40 // done before the session allocated above is considered valid.
39 bool VerifySession(UUID userID, UUID sessionID); 41 // Repeated calls to this method with the same auth token will
42 // create different keys and invalidate the previous ne.
43 //
44 string GetUserKey(UUID userID, string authToken);
45
46 // Verify that a user key is valid
47 //
48 bool VerifyUserKey(UUID userID, string key);
49
50 // Verify that a user session ID is valid. A session ID is
51 // considered valid when a user has successfully authenticated
52 // at least one time inside that session.
53 //
54 bool VerifyUserSession(UUID userID, UUID session);
55
56 // Remove a user session identifier and deauthenticate the user
57 //
58 void DestroyUserSession(UUID userID);
40 } 59 }
41} 60}