Add option to allow remote http calls to setpassword in the AuthenticationService.
This is switched on by setting AllowSetPassword = true in the [AuthenticationService] section of Robust.ini or Robust.HG.ini Default is false as before.remove-scene-viewer
parent
fe484ab331
commit
d9184eceab
|
@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
|
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
|
||||||
|
|
||||||
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService));
|
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,20 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IAuthenticationService m_AuthenticationService;
|
private IAuthenticationService m_AuthenticationService;
|
||||||
|
private bool m_AllowSetPassword = false;
|
||||||
|
|
||||||
public AuthenticationServerPostHandler(IAuthenticationService service) :
|
public AuthenticationServerPostHandler(IAuthenticationService service) :
|
||||||
|
this(service, null) {}
|
||||||
|
|
||||||
|
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) :
|
||||||
base("POST", "/auth")
|
base("POST", "/auth")
|
||||||
{
|
{
|
||||||
m_AuthenticationService = service;
|
m_AuthenticationService = service;
|
||||||
|
|
||||||
|
if (config != null)
|
||||||
|
{
|
||||||
|
m_AllowSetPassword = config.GetBoolean("AllowSetPassword", m_AllowSetPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte[] Handle(string path, Stream request,
|
public override byte[] Handle(string path, Stream request,
|
||||||
|
@ -113,31 +122,45 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
|
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case "authenticate":
|
case "authenticate":
|
||||||
if (!request.ContainsKey("PASSWORD"))
|
if (!request.ContainsKey("PASSWORD"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
|
||||||
|
|
||||||
|
if (token != String.Empty)
|
||||||
|
return SuccessResult(token);
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
|
case "setpassword":
|
||||||
|
if (!m_AllowSetPassword)
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
if (token != String.Empty)
|
if (!request.ContainsKey("PASSWORD"))
|
||||||
return SuccessResult(token);
|
return FailureResult();
|
||||||
return FailureResult();
|
|
||||||
case "verify":
|
if (m_AuthenticationService.SetPassword(principalID, request["PASSWORD"].ToString()))
|
||||||
if (!request.ContainsKey("TOKEN"))
|
return SuccessResult();
|
||||||
|
else
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
case "verify":
|
||||||
|
if (!request.ContainsKey("TOKEN"))
|
||||||
|
return FailureResult();
|
||||||
|
|
||||||
|
if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
|
||||||
|
return SuccessResult();
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
|
case "release":
|
||||||
return SuccessResult();
|
if (!request.ContainsKey("TOKEN"))
|
||||||
|
return FailureResult();
|
||||||
return FailureResult();
|
|
||||||
case "release":
|
if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
|
||||||
if (!request.ContainsKey("TOKEN"))
|
return SuccessResult();
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
|
|
||||||
return SuccessResult();
|
|
||||||
|
|
||||||
return FailureResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
|
@ -146,6 +146,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
; Realm = "useraccounts"
|
; Realm = "useraccounts"
|
||||||
|
|
||||||
|
;; Allow the service to process HTTP setpassword calls.
|
||||||
|
;; Default is false.
|
||||||
|
; AllowSetPassword = false
|
||||||
|
|
||||||
[OpenIdService]
|
[OpenIdService]
|
||||||
; for the server connector
|
; for the server connector
|
||||||
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
|
@ -173,11 +177,11 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
;; Default is false
|
;; Default is false
|
||||||
; CreateDefaultAvatarEntries = false
|
; CreateDefaultAvatarEntries = false
|
||||||
|
|
||||||
;; Allow the service to process HTTP create user calls.
|
;; Allow the service to process HTTP createuser calls.
|
||||||
;; Default is false.
|
;; Default is false.
|
||||||
; AllowCreateUser = false
|
; AllowCreateUser = false
|
||||||
|
|
||||||
;; Allow the service to process HTTP set account calls.
|
;; Allow the service to process HTTP setaccount calls.
|
||||||
;; Default is false.
|
;; Default is false.
|
||||||
; AllowSetAccount = false
|
; AllowSetAccount = false
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
; for the server connector
|
; for the server connector
|
||||||
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
|
|
||||||
|
;; Allow the service to process HTTP setpassword calls.
|
||||||
|
;; Default is false.
|
||||||
|
; AllowSetPassword = false
|
||||||
|
|
||||||
[OpenIdService]
|
[OpenIdService]
|
||||||
; for the server connector
|
; for the server connector
|
||||||
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||||
|
@ -156,11 +160,11 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
||||||
;; Default is false
|
;; Default is false
|
||||||
; CreateDefaultAvatarEntries = false
|
; CreateDefaultAvatarEntries = false
|
||||||
|
|
||||||
;; Allow the service to process HTTP create user calls.
|
;; Allow the service to process HTTP createuser calls.
|
||||||
;; Default is false.
|
;; Default is false.
|
||||||
; AllowCreateUser = false
|
; AllowCreateUser = false
|
||||||
|
|
||||||
;; Allow the service to process HTTP set account calls.
|
;; Allow the service to process HTTP setaccount calls.
|
||||||
;; Default is false.
|
;; Default is false.
|
||||||
; AllowSetAccount = false
|
; AllowSetAccount = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue