59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
namespace Pluto.Api {
|
|
using System;
|
|
using RemObjects.SDK;
|
|
using RemObjects.SDK.Types;
|
|
using RemObjects.SDK.Server;
|
|
using RemObjects.SDK.Server.ClassFactories;
|
|
using PlutoServer.PracticeChoice;
|
|
|
|
|
|
[RemObjects.SDK.Server.ClassFactories.StandardClassFactory()]
|
|
[RemObjects.SDK.Server.Service(Name = "Authentication", InvokerClass = typeof(Authentication_Invoker), ActivatorClass = typeof(Authentication_Activator))]
|
|
public class Authentication : RemObjects.SDK.Server.Service, IAuthentication {
|
|
|
|
private System.ComponentModel.Container components = null;
|
|
public Authentication() :
|
|
base() {
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
private void InitializeComponent() {
|
|
|
|
}
|
|
|
|
protected override void Dispose(bool aDisposing) {
|
|
if(aDisposing) {
|
|
if((this.components != null)) {
|
|
this.components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose(aDisposing);
|
|
}
|
|
|
|
public virtual UserInfo1 Login1(string apiKey, PracticeInfo1 practiceInfo, string userId, string password) {
|
|
UserInfo1 userInfo = null;
|
|
var auth = new PlutoServer.PracticeChoice.Security.Authentication();
|
|
try {
|
|
userInfo = auth.Login(userId, password, practiceInfo.Id);
|
|
if(!string.IsNullOrEmpty(userInfo.AuthToken)) {
|
|
System.Diagnostics.Debug.WriteLine(this.SessionID.ToString());
|
|
this.Session[SessionKeys.AuthToken] = userInfo.AuthToken;
|
|
}
|
|
} catch(Exception ex) {
|
|
this.DestroySession();
|
|
throw;
|
|
}
|
|
return userInfo;
|
|
}
|
|
|
|
#region IAuthentication Members
|
|
|
|
|
|
public PracticeInfo1[] GetPracticeList1(string apiKey) {
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|