本文整理汇总了C#中MonkeyWrench.DataClasses.Logic.WebServiceLogin类的典型用法代码示例。如果您正苦于以下问题:C# WebServiceLogin类的具体用法?C# WebServiceLogin怎么用?C# WebServiceLogin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebServiceLogin类属于MonkeyWrench.DataClasses.Logic命名空间,在下文中一共展示了WebServiceLogin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: cmdLogin_Click
protected void cmdLogin_Click (object sender, EventArgs e)
{
LoginResponse response;
Master.ClearLogin ();
try {
WebServiceLogin login = new WebServiceLogin ();
login.User = txtUser.Text;
login.Password = txtPassword.Text;
Console.WriteLine ("Trying to log in with {0}/{1}", login.User, login.Password);
login.Ip4 = Utilities.GetExternalIP (Context.Request);
response = Master.WebService.Login (login);
if (response == null) {
lblMessage.Text = "Could not log in.";
txtPassword.Text = "";
} else {
Console.WriteLine ("Login.aspx: Saved cookie!");
FormsAuthenticationTicket cookie = new FormsAuthenticationTicket ("cookie", true, 60 * 24);
Response.Cookies.Add (new HttpCookie ("cookie", response.Cookie));
Response.Cookies ["cookie"].Expires = DateTime.Now.AddDays (1);
Response.Cookies.Add (new HttpCookie ("user", login.User));
FormsAuthentication.SetAuthCookie (response.User, true);
Response.Redirect (txtReferrer.Value, false);
}
} catch (Exception) {
lblMessage.Text = "Invalid user/password.";
txtPassword.Text = "";
}
}
开发者ID:rolfbjarne,项目名称:monkeywrench,代码行数:30,代码来源:Login.aspx.cs
示例2: VerifyUserInRoles
private void VerifyUserInRoles (DB db, WebServiceLogin login, string[] roles, bool @readonly)
{
// Administrator should be given access to everything.
// So any call to VerifyUserInRoles should add Administrator to that list.
var completeRoles = roles.Concat(new string[] { Roles.Administrator }).ToArray();
Authentication.VerifyUserInRoles (Context, db, login, completeRoles, @readonly);
}
开发者ID:mono,项目名称:monkeywrench,代码行数:7,代码来源:WebServices.asmx.cs
示例3: Login
public LoginResponse Login (WebServiceLogin login)
{
LoginResponse response = new LoginResponse ();
using (DB db = new DB ()) {
Authenticate (db, login, response);
response.User = login.User;
return response;
}
}
开发者ID:DavidS,项目名称:monkeywrench,代码行数:9,代码来源:WebServices.asmx.cs
示例4: LoginOpenId
public LoginResponse LoginOpenId (WebServiceLogin login, string email, string ip4)
{
LoginResponse response = new LoginResponse ();
using (DB db = new DB ()) {
VerifyUserInRole (db, login, Roles.Administrator);
DBLogin_Extensions.LoginOpenId (db, response, email, ip4);
return response;
}
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:10,代码来源:WebServices.asmx.cs
示例5: GetHostHistory
private Dictionary<string, IEnumerable<HostHistoryEntry>> GetHostHistory (WebServiceLogin web_service_login, int limit, int offset) {
var hosts = Utils.LocalWebService.GetHosts (login).Hosts.OrderBy(h => h.host);
var hostHistoryResponses = hosts.Select (host =>
Utils.LocalWebService.GetWorkHostHistory (login, host.id, "", limit, offset));
var hostHistories = hostHistoryResponses.ToDictionary (
hr => hr.Host.host,
hr => Enumerable.Range(0, hr.RevisionWorks.Count)
.Select(i => new HostHistoryEntry (hr, i))
);
return hostHistories;
}
开发者ID:modulexcite,项目名称:monkeywrench,代码行数:12,代码来源:Json.aspx.cs
示例6: GetBotInfo
private string GetBotInfo (WebServiceLogin login, bool showHostHistory) {
var hoststatusresponse = Utils.LocalWebService.GetHostStatus (login);
var node_information = new Dictionary<string, object> {
{ "inactiveNodes", GetInactiveHosts (login, hoststatusresponse) },
{ "activeNodes", GetActiveHosts (login, hoststatusresponse) },
{ "downNodes", GetDownHosts (login, hoststatusresponse) }
// { "pendingJobs", "asdf" }
};
if (showHostHistory)
node_information.Add ("hostHistory", GetHostHistory (login, limit, offset));
return JsonConvert.SerializeObject (node_information, Formatting.Indented);
}
开发者ID:modulexcite,项目名称:monkeywrench,代码行数:12,代码来源:Json.aspx.cs
示例7: CreateWebServiceLogin
public static WebServiceLogin CreateWebServiceLogin (HttpRequest Request)
{
WebServiceLogin web_service_login;
web_service_login = new WebServiceLogin ();
web_service_login.Cookie = GetCookie (Request, "cookie");
if (HttpContext.Current.User != null)
web_service_login.User = GetCookie (Request, "user");
web_service_login.Ip4 = GetExternalIP (Request);
// Console.WriteLine ("Master, Cookie: {0}, User: {1}", web_service_login.Cookie, web_service_login.User);
return web_service_login;
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:13,代码来源:Utilities.cs
示例8: getLatestRevision
string getLatestRevision (WebServiceLogin login, string laneName, int step, int offset, int limit){
var lane = Utils.WebService.FindLane (login, null, laneName).lane;
var revisions = Utils.WebService.GetRevisions (login, null, laneName, step, offset).Revisions;
var revisionWorks = revisions.Select (r => Utils.WebService.GetRevisionWorkForLane (login, lane.id, r.id, -1).RevisionWork).ToList ();
var validRevisions = revisionWorks.Find (wl => validRevision (login, wl));
if (validRevisions != null) {
return getRevisionName (revisions, validRevisions.First ().revision_id);
} else if (offset < limit) {
return getLatestRevision (login, laneName, step, offset + step, limit);
} else {
return "";
}
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:14,代码来源:GetLatest.aspx.cs
示例9: LoginOpenId
public LoginResponse LoginOpenId (WebServiceLogin login, string email, string ip4)
{
LoginResponse response = new LoginResponse ();
using (DB db = new DB ()) {
try {
VerifyUserInRole (db, login, Roles.Administrator);
db.Audit (login, "WebServices.LoginOpenId (email: {0}, ip4: {1})", email, ip4);
DBLogin_Extensions.LoginOpenId (db, response, email, ip4);
} catch (Exception ex) {
response.Exception = new WebServiceException (ex);
}
return response;
}
}
开发者ID:vargaz,项目名称:monkeywrench,代码行数:15,代码来源:WebServices.asmx.cs
示例10: Login
public static bool Login (string user, string password, HttpRequest Request, HttpResponse Response)
{
LoginResponse response;
WebServiceLogin login = new WebServiceLogin ();
login.User = user;
login.Password = password;
login.Ip4 = MonkeyWrench.Utilities.GetExternalIP (Request);
response = Utils.WebService.Login (login);
if (response == null) {
Logger.Log ("Login failed");
return false;
} else {
SetCookies (Response, response);
return true;
}
}
开发者ID:hackmp,项目名称:monkeywrench,代码行数:18,代码来源:Authentication.cs
示例11: Login
public static bool Login (string user, string password, HttpRequest Request, HttpResponse Response)
{
LoginResponse response;
WebServiceLogin login = new WebServiceLogin ();
login.User = user;
login.Password = password;
login.Ip4 = MonkeyWrench.Utilities.GetExternalIP (Request);
response = Utils.WebService.Login (login);
if (response == null) {
Logger.Log ("Login failed");
return false;
} else {
Logger.Log ("Login succeeded, cookie: {0}", response.Cookie);
Response.Cookies.Add (new HttpCookie ("cookie", response.Cookie));
Response.Cookies ["cookie"].Expires = DateTime.Now.AddDays (1);
Response.Cookies.Add (new HttpCookie ("user", login.User));
/* Note that the 'roles' cookie is only used to determine the web ui to show, it's not used to authorize anything */
Response.Cookies.Add (new HttpCookie ("roles", string.Join (", ", Utils.WebService.GetRoles (login.User))));
return true;
}
}
开发者ID:DavidS,项目名称:monkeywrench,代码行数:23,代码来源:Authentication.cs
示例12: FindRevisionForLane
public FindRevisionResponse FindRevisionForLane (WebServiceLogin login, int? revision_id, string revision, int? lane_id, string lane)
{
FindRevisionResponse response = new FindRevisionResponse ();
using (DB db = new DB ()) {
Authenticate (db, login, response, true);
if ((revision_id == null || revision_id.Value <= 0) && string.IsNullOrEmpty (revision))
return response;
if ((lane_id == null || lane_id.Value <= 0) && string.IsNullOrEmpty (lane))
return response;
using (IDbCommand cmd = db.CreateCommand ()) {
if (!lane_id.HasValue) {
if (!revision_id.HasValue) {
cmd.CommandText = "SELECT * FROM Revision INNER JOIN Lane ON Revision.lane_id = Lane.id WHERE Revision.revision = @revision AND Lane.lane = @lane;";
DB.CreateParameter (cmd, "revision", revision);
} else {
cmd.CommandText = "SELECT * FROM Revision INNER JOIN Lane ON Revision.lane_id = Lane.id WHERE id = @id AND Lane.lane = @lane;";
DB.CreateParameter (cmd, "id", revision_id.Value);
}
DB.CreateParameter (cmd, "lane", lane);
} else {
if (!revision_id.HasValue) {
cmd.CommandText = "SELECT * FROM Revision WHERE revision = @revision AND lane_id = @lane_id;";
DB.CreateParameter (cmd, "revision", revision);
} else {
cmd.CommandText = "SELECT * FROM Revision WHERE id = @id AND lane_id = @lane_id;";
DB.CreateParameter (cmd, "id", revision_id.Value);
}
DB.CreateParameter (cmd, "lane_id", lane_id.Value);
}
DB.CreateParameter (cmd, "lane_id", lane_id);
using (IDataReader reader = cmd.ExecuteReader ()) {
if (reader.Read ()) {
response.Revision = new DBRevision (reader);
}
}
}
}
return response;
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:44,代码来源:WebServices.asmx.cs
示例13: FindHost
public FindHostResponse FindHost (WebServiceLogin login, int? host_id, string host)
{
FindHostResponse response = new FindHostResponse ();
using (DB db = new DB ()) {
Authenticate (db, login, response);
response.Host = FindHost (db, host_id, host);
return response;
}
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:11,代码来源:WebServices.asmx.cs
示例14: GetLaneForEdit
public GetLaneForEditResponse GetLaneForEdit (WebServiceLogin login, int lane_id, string lane)
{
GetLaneForEditResponse response = new GetLaneForEditResponse ();
using (DB db = new DB ()) {
Authenticate (db, login, response);
VerifyUserInRole (db, login, Roles.Administrator);
// We do 2 trips to the database: first to get a list of all the lanes,
// then to get all the rest of the information.
response.Lanes = db.GetAllLanes ();
if (lane_id > 0) {
response.Lane = response.Lanes.Find ((l) => l.id == lane_id);
} else {
response.Lane = response.Lanes.Find ((l) => l.lane == lane);
}
var cmdText = new StringBuilder ();
using (var cmd = db.CreateCommand ()) {
// 1: db.GetAllLanes
cmdText.AppendLine ("SELECT * FROM Lane ORDER BY lane;");
// 2: response.Lane.GetCommandsInherited (db, response.Lanes);
cmdText.Append ("SELECT * FROM Command WHERE lane_id = ").Append (response.Lane.id);
DBLane parent = response.Lane;
while (null != (parent = response.Lanes.FirstOrDefault ((v) => v.id == parent.parent_lane_id))) {
cmdText.Append (" OR lane_id = ").Append (parent.id);
}
cmdText.AppendLine (" ORDER BY sequence;");
// 3: response.Dependencies = response.Lane.GetDependencies (db);
cmdText.AppendFormat ("SELECT * FROM LaneDependency WHERE lane_id = {0} ORDER BY dependent_lane_id;", response.Lane.id).AppendLine ();
// // 4: response.FileDeletionDirectives = DBFileDeletionDirective_Extensions.GetAll (db);
// cmdText.AppendLine ("SELECT * FROM FileDeletionDirective;");
//
// // 5: response.LaneDeletionDirectives = DBLaneDeletionDirectiveView_Extensions.Find (db, response.Lane);
// cmdText.AppendFormat ("SELECT * FROM LaneDeletionDirectiveView WHERE lane_id = {0};", response.Lane.id).AppendLine ();
// 6: response.Files = response.Lane.GetFiles (db, response.Lanes);
cmdText.Append (@"
SELECT Lanefile.id, LaneFile.name, '' AS contents, LaneFile.mime, Lanefile.original_id, LaneFile.changed_date
FROM Lanefile
INNER JOIN Lanefiles ON Lanefiles.lanefile_id = Lanefile.id
WHERE Lanefile.original_id IS NULL AND Lanefiles.lane_id = ").Append (response.Lane.id);
parent = response.Lane;
while (null != (parent = response.Lanes.FirstOrDefault ((v) => v.id == parent.parent_lane_id))) {
cmdText.Append (" OR LaneFiles.lane_id = ").Append (parent.id);
}
cmdText.AppendLine (" ORDER BY name ASC;");
// 7: response.LaneFiles = db.GetAllLaneFiles ();
cmdText.AppendLine ("SELECT * FROM LaneFiles;");
// 8: response.HostLaneViews = response.Lane.GetHosts (db);
cmdText.AppendFormat ("SELECT * FROM HostLaneView WHERE lane_id = {0} ORDER BY host;", response.Lane.id).AppendLine ();
// 9: response.Hosts = db.GetHosts ();
cmdText.AppendLine ("SELECT * FROM Host ORDER BY host;");
// 10: response.ExistingFiles = new List<DBLanefile> (); [...]
cmdText.AppendFormat (@"
SELECT Lanefile.id, LaneFile.name, '' AS contents, LaneFile.mime, Lanefile.original_id, LaneFile.changed_date
FROM Lanefile
INNER JOIN Lanefiles ON Lanefiles.lanefile_id = Lanefile.id
WHERE Lanefile.original_id IS NULL AND Lanefiles.lane_id <> {0}
ORDER BY Lanefiles.lane_id, Lanefile.name ASC;", response.Lane.id).AppendLine ();
// 11: response.Variables = DBEnvironmentVariable_Extensions.Find (db, response.Lane.id, null, null);
cmdText.AppendFormat ("SELECT * FROM EnvironmentVariable WHERE lane_id = {0} AND host_id IS NULL ORDER BY id ASC;", response.Lane.id).AppendLine ();
// 12: response.Notifications = new List<DBNotification> ();
cmdText.AppendLine ("SELECT * FROM Notification;");
// 13: response.LaneNotifications = new List<DBLaneNotification> ();
cmdText.AppendFormat ("SELECT * FROM LaneNotification WHERE lane_id = {0};", response.Lane.id).AppendLine ();
// 14
cmdText.AppendFormat ("SELECT * FROM LaneTag WHERE lane_id = {0};", response.Lane.id).AppendLine ();
cmd.CommandText = cmdText.ToString ();
using (IDataReader reader = cmd.ExecuteReader ()) {
// 1: db.GetAllLanes
response.Lanes = new List<DBLane> ();
while (reader.Read ())
response.Lanes.Add (new DBLane (reader));
// 2: response.Lane.GetCommandsInherited (db, response.Lanes);
reader.NextResult ();
response.Commands = new List<DBCommand> ();
while (reader.Read ())
response.Commands.Add (new DBCommand (reader));
// 3: response.Dependencies = response.Lane.GetDependencies (db);
reader.NextResult ();
response.Dependencies = new List<DBLaneDependency> ();
while (reader.Read ())
//.........这里部分代码省略.........
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:101,代码来源:WebServices.asmx.cs
示例15: RemoveMasterHost
public void RemoveMasterHost (WebServiceLogin login, int host_id, int masterhost_id)
{
using (DB db = new DB ()) {
VerifyUserInRole (db, login, Roles.Administrator);
using (IDbCommand cmd = db.CreateCommand ()) {
cmd.CommandText = "DELETE FROM MasterHost WHERE host_id = @host_id AND master_host_id = @masterhost_id;";
DB.CreateParameter (cmd, "host_id", host_id);
DB.CreateParameter (cmd, "masterhost_id", masterhost_id);
cmd.ExecuteNonQuery ();
}
}
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:13,代码来源:WebServices.asmx.cs
示例16: AddMasterHost
public void AddMasterHost (WebServiceLogin login, int host_id, int masterhost_id)
{
using (DB db = new DB ()) {
VerifyUserInRole (db, login, Roles.Administrator);
DBMasterHost mh = new DBMasterHost ();
mh.master_host_id = masterhost_id;
mh.host_id = host_id;
mh.Save (db);
}
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:11,代码来源:WebServices.asmx.cs
示例17: GetHostForEdit
public GetHostForEditResponse GetHostForEdit (WebServiceLogin login, int? host_id, string host)
{
GetHostForEditResponse response = new GetHostForEditResponse ();
using (DB db = new DB ()) {
VerifyUserInRole (db, login, Roles.Administrator);
response.Host = FindHost (db, host_id, host);
response.Lanes = db.GetAllLanes ();
if (response.Host != null) {
response.Person = FindPerson (db, response.Host.host);
response.HostLaneViews = response.Host.GetLanes (db);
response.Variables = DBEnvironmentVariable_Extensions.Find (db, null, response.Host.id, null);
response.MasterHosts = GetMasterHosts (db, response.Host);
response.SlaveHosts = GetSlaveHosts (db, response.Host);
}
response.Hosts = db.GetHosts ();
}
return response;
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:21,代码来源:WebServices.asmx.cs
示例18: Audit
private void Audit(WebServiceLogin login, string formatStr, params Object[] formatArgs) {
auditLog.InfoFormat ("User {0}@{1} {2}", login.User, login.Ip4, String.Format (formatStr, formatArgs));
}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:3,代码来源:WebServices.asmx.cs
示例19: Authenticate
/// <summary>
/// Authenticates the request with the provided user/pass.
/// If no user/pass is provided, the method returns a response
/// with no roles.
/// If a wrong user/pass is provided, the method throws an exception.
/// </summary>
/// <param name="db"></param>
/// <param name="login"></param>
/// <param name="response"></param>
public static void Authenticate (HttpContext Context, DB db, WebServiceLogin login, WebServiceResponse response, bool @readonly)
{
Authenticate (Context.Request.UserHostAddress, db, login, response, @readonly);
}
开发者ID:hackmp,项目名称:monkeywrench,代码行数:13,代码来源:Authentication.cs
示例20: VerifyAnonymousAccess
/// <summary>
/// Verify that the user is a valid user if anonymous access isn't allowed
/// </summary>
/// <param name="Context"></param>
/// <param name="db"></param>
/// <param name="login"></param>
public static void VerifyAnonymousAccess (HttpContext Context, DB db, WebServiceLogin login)
{
if (Configuration.AllowAnonymousAccess)
return;
Authenticate (Context, db, login, null, true);
}
开发者ID:hackmp,项目名称:monkeywrench,代码行数:12,代码来源:Authentication.cs
注:本文中的MonkeyWrench.DataClasses.Logic.WebServiceLogin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论