aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs2
-rw-r--r--OpenSim/Framework/ServiceAuth/CompoundAuthentication.cs13
-rw-r--r--OpenSim/Framework/ServiceAuth/DisallowLlHttpRequest.cs2
-rw-r--r--OpenSim/Framework/ServiceAuth/IServiceAuth.cs7
-rw-r--r--OpenSim/Framework/ServiceAuth/ServiceAuth.cs8
5 files changed, 29 insertions, 3 deletions
diff --git a/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs
index 3c13bbf..b20f8f5 100644
--- a/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs
+++ b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Framework.ServiceAuth
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 public string Name { get { return "BasicHttp"; } }
44
43 private string m_Username, m_Password; 45 private string m_Username, m_Password;
44 private string m_CredentialsB64; 46 private string m_CredentialsB64;
45 47
diff --git a/OpenSim/Framework/ServiceAuth/CompoundAuthentication.cs b/OpenSim/Framework/ServiceAuth/CompoundAuthentication.cs
index 8c88d1c..a49952c 100644
--- a/OpenSim/Framework/ServiceAuth/CompoundAuthentication.cs
+++ b/OpenSim/Framework/ServiceAuth/CompoundAuthentication.cs
@@ -35,10 +35,17 @@ namespace OpenSim.Framework.ServiceAuth
35{ 35{
36 public class CompoundAuthentication : IServiceAuth 36 public class CompoundAuthentication : IServiceAuth
37 { 37 {
38 public string Name { get { return "Compound"; } }
39
38 private List<IServiceAuth> m_authentications = new List<IServiceAuth>(); 40 private List<IServiceAuth> m_authentications = new List<IServiceAuth>();
39 41
40 public int Count { get { return m_authentications.Count; } } 42 public int Count { get { return m_authentications.Count; } }
41 43
44 public List<IServiceAuth> GetAuthentors()
45 {
46 return new List<IServiceAuth>(m_authentications);
47 }
48
42 public void AddAuthenticator(IServiceAuth auth) 49 public void AddAuthenticator(IServiceAuth auth)
43 { 50 {
44 m_authentications.Add(auth); 51 m_authentications.Add(auth);
@@ -49,7 +56,11 @@ namespace OpenSim.Framework.ServiceAuth
49 m_authentications.Remove(auth); 56 m_authentications.Remove(auth);
50 } 57 }
51 58
52 public void AddAuthorization(NameValueCollection headers) {} 59 public void AddAuthorization(NameValueCollection headers)
60 {
61 foreach (IServiceAuth auth in m_authentications)
62 auth.AddAuthorization(headers);
63 }
53 64
54 public bool Authenticate(string data) 65 public bool Authenticate(string data)
55 { 66 {
diff --git a/OpenSim/Framework/ServiceAuth/DisallowLlHttpRequest.cs b/OpenSim/Framework/ServiceAuth/DisallowLlHttpRequest.cs
index 1e1ee56..e0c413b 100644
--- a/OpenSim/Framework/ServiceAuth/DisallowLlHttpRequest.cs
+++ b/OpenSim/Framework/ServiceAuth/DisallowLlHttpRequest.cs
@@ -33,6 +33,8 @@ namespace OpenSim.Framework.ServiceAuth
33{ 33{
34 public class DisallowLlHttpRequest : IServiceAuth 34 public class DisallowLlHttpRequest : IServiceAuth
35 { 35 {
36 public string Name { get { return "DisallowllHTTPRequest"; } }
37
36 public void AddAuthorization(NameValueCollection headers) {} 38 public void AddAuthorization(NameValueCollection headers) {}
37 39
38 public bool Authenticate(string data) 40 public bool Authenticate(string data)
diff --git a/OpenSim/Framework/ServiceAuth/IServiceAuth.cs b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs
index adde62f..5f744cb 100644
--- a/OpenSim/Framework/ServiceAuth/IServiceAuth.cs
+++ b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs
@@ -34,8 +34,13 @@ namespace OpenSim.Framework.ServiceAuth
34{ 34{
35 public delegate void AddHeaderDelegate(string key, string value); 35 public delegate void AddHeaderDelegate(string key, string value);
36 36
37 public interface IServiceAuth 37 public interface IServiceAuth
38 { 38 {
39 /// <summary>
40 /// Name of this authenticator.
41 /// </summary>
42 string Name { get; }
43
39 bool Authenticate(string data); 44 bool Authenticate(string data);
40 bool Authenticate(NameValueCollection headers, AddHeaderDelegate d, out HttpStatusCode statusCode); 45 bool Authenticate(NameValueCollection headers, AddHeaderDelegate d, out HttpStatusCode statusCode);
41 void AddAuthorization(NameValueCollection headers); 46 void AddAuthorization(NameValueCollection headers);
diff --git a/OpenSim/Framework/ServiceAuth/ServiceAuth.cs b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs
index 30f5bd6..51012e3 100644
--- a/OpenSim/Framework/ServiceAuth/ServiceAuth.cs
+++ b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs
@@ -27,13 +27,16 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30using System.Reflection;
31using log4net;
31using Nini.Config; 32using Nini.Config;
32 33
33namespace OpenSim.Framework.ServiceAuth 34namespace OpenSim.Framework.ServiceAuth
34{ 35{
35 public class ServiceAuth 36 public class ServiceAuth
36 { 37 {
38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
37 public static IServiceAuth Create(IConfigSource config, string section) 40 public static IServiceAuth Create(IConfigSource config, string section)
38 { 41 {
39 CompoundAuthentication compoundAuth = new CompoundAuthentication(); 42 CompoundAuthentication compoundAuth = new CompoundAuthentication();
@@ -53,6 +56,9 @@ namespace OpenSim.Framework.ServiceAuth
53 break; 56 break;
54 } 57 }
55 58
59// foreach (IServiceAuth auth in compoundAuth.GetAuthentors())
60// m_log.DebugFormat("[SERVICE AUTH]: Configured authenticator {0}", auth.Name);
61
56 if (compoundAuth.Count > 0) 62 if (compoundAuth.Count > 0)
57 return compoundAuth; 63 return compoundAuth;
58 else 64 else