diff options
Diffstat (limited to 'OpenSim/Services')
4 files changed, 42 insertions, 26 deletions
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 200268b..2ed177c 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Services.AuthenticationService | |||
53 | { | 53 | { |
54 | string dllName = String.Empty; | 54 | string dllName = String.Empty; |
55 | string connString = String.Empty; | 55 | string connString = String.Empty; |
56 | string realm = String.Empty; | 56 | string realm = "auth"; |
57 | 57 | ||
58 | // | 58 | // |
59 | // Try reading the [AuthenticationService] section first, if it exists | 59 | // Try reading the [AuthenticationService] section first, if it exists |
@@ -95,14 +95,34 @@ namespace OpenSim.Services.AuthenticationService | |||
95 | return new byte[0]; | 95 | return new byte[0]; |
96 | } | 96 | } |
97 | 97 | ||
98 | public virtual bool Release(UUID principalID, string token) | 98 | public bool Verify(UUID principalID, string token, int lifetime) |
99 | { | ||
100 | return m_Database.CheckToken(principalID, token, lifetime); | ||
101 | } | ||
102 | |||
103 | public bool VerifyEncrypted(byte[] cyphertext, byte[] key) | ||
99 | { | 104 | { |
100 | return false; | 105 | return false; |
101 | } | 106 | } |
102 | 107 | ||
108 | public virtual bool Release(UUID principalID, string token) | ||
109 | { | ||
110 | return m_Database.CheckToken(principalID, token, 0); | ||
111 | } | ||
112 | |||
103 | public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key) | 113 | public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key) |
104 | { | 114 | { |
105 | return false; | 115 | return false; |
106 | } | 116 | } |
117 | |||
118 | protected string GetToken(UUID principalID, int lifetime) | ||
119 | { | ||
120 | UUID token = UUID.Random(); | ||
121 | |||
122 | if (m_Database.SetToken(principalID, token.ToString(), lifetime)) | ||
123 | return token.ToString(); | ||
124 | |||
125 | return String.Empty; | ||
126 | } | ||
107 | } | 127 | } |
108 | } | 128 | } |
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 83ce0d0..7fdbbf6 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -56,8 +56,24 @@ namespace OpenSim.Services.AuthenticationService | |||
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | public string Authenticate(UUID principalID, string password) | 59 | public string Authenticate(UUID principalID, string password, int lifetime) |
60 | { | 60 | { |
61 | AuthenticationData data = m_Database.Get(principalID); | ||
62 | |||
63 | if (!data.Data.ContainsKey("passwordHash") || | ||
64 | !data.Data.ContainsKey("passwordSalt")) | ||
65 | { | ||
66 | return String.Empty; | ||
67 | } | ||
68 | |||
69 | string hashed = Util.Md5Hash(Util.Md5Hash(password) + ":" + | ||
70 | data.Data["passwordSalt"].ToString()); | ||
71 | |||
72 | if (data.Data["passwordHash"].ToString() == hashed) | ||
73 | { | ||
74 | return GetToken(principalID, lifetime); | ||
75 | } | ||
76 | |||
61 | return String.Empty; | 77 | return String.Empty; |
62 | } | 78 | } |
63 | 79 | ||
@@ -65,15 +81,5 @@ namespace OpenSim.Services.AuthenticationService | |||
65 | { | 81 | { |
66 | return new byte[0]; | 82 | return new byte[0]; |
67 | } | 83 | } |
68 | |||
69 | public bool Verify(UUID principalID, string token) | ||
70 | { | ||
71 | return false; | ||
72 | } | ||
73 | |||
74 | public bool VerifyEncrypted(byte[] cyphertext, byte[] key) | ||
75 | { | ||
76 | return false; | ||
77 | } | ||
78 | } | 84 | } |
79 | } | 85 | } |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index af55df0..0118c91 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Services.AuthenticationService | |||
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | ||
55 | public string Authenticate(UUID principalID, string password) | 55 | public string Authenticate(UUID principalID, string password, int lifetime) |
56 | { | 56 | { |
57 | return String.Empty; | 57 | return String.Empty; |
58 | } | 58 | } |
@@ -61,15 +61,5 @@ namespace OpenSim.Services.AuthenticationService | |||
61 | { | 61 | { |
62 | return new byte[0]; | 62 | return new byte[0]; |
63 | } | 63 | } |
64 | |||
65 | public bool Verify(UUID principalID, string token) | ||
66 | { | ||
67 | return false; | ||
68 | } | ||
69 | |||
70 | public bool VerifyEncrypted(byte[] cyphertext, byte[] key) | ||
71 | { | ||
72 | return false; | ||
73 | } | ||
74 | } | 64 | } |
75 | } | 65 | } |
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs index f042c93..b448a14 100644 --- a/OpenSim/Services/Interfaces/IAuthenticationService.cs +++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Services.Interfaces | |||
70 | // the public key of the peer, which the connector must have | 70 | // the public key of the peer, which the connector must have |
71 | // obtained using a remote GetPublicKey call. | 71 | // obtained using a remote GetPublicKey call. |
72 | // | 72 | // |
73 | string Authenticate(UUID principalID, string password); | 73 | string Authenticate(UUID principalID, string password, int lifetime); |
74 | byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key); | 74 | byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key); |
75 | 75 | ||
76 | ////////////////////////////////////////////////////// | 76 | ////////////////////////////////////////////////////// |
@@ -85,7 +85,7 @@ namespace OpenSim.Services.Interfaces | |||
85 | // must be used to refresh. Unencrypted verification is still | 85 | // must be used to refresh. Unencrypted verification is still |
86 | // performed, but doesn't refresh token lifetime. | 86 | // performed, but doesn't refresh token lifetime. |
87 | // | 87 | // |
88 | bool Verify(UUID principalID, string token); | 88 | bool Verify(UUID principalID, string token, int lifetime); |
89 | bool VerifyEncrypted(byte[] cyphertext, byte[] key); | 89 | bool VerifyEncrypted(byte[] cyphertext, byte[] key); |
90 | 90 | ||
91 | ////////////////////////////////////////////////////// | 91 | ////////////////////////////////////////////////////// |