/// <summary> /// 请求授权地址 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(Gitee_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { GiteeConfig.API_Authorize, "?client_id=", entity.client_id, "&response_type=", entity.response_type, "&state=", entity.state, "&redirect_uri=", NetnrCore.ToEncode(entity.redirect_uri) })); }
/// <summary> /// 请求授权地址 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(StackOverflow_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { StackOverflowConfig.API_Authorize, "?client_id=", entity.client_id, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", entity.redirect_uri.ToEncode() })); }
/// <summary> /// Step1:获取Authorization Code /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizationHref(WeChat_Authorization_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { WeChatConfig.API_Authorization, "?appid=", entity.appid, "&response_type=", entity.response_type, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", NetnrCore.ToEncode(entity.redirect_uri) })); }
/// <summary> /// 请求授权地址,密码登录 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref_Password(DingTalk_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { DingTalkConfig.API_Authorize_Password, "?appid=", entity.appid, "&response_type=", entity.response_type, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", entity.redirect_uri.ToEncode() })); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity">签名参数</param> /// <returns></returns> public static StackOverflow_User_ResultEntity User(StackOverflow_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = Core.HttpTo.Get(StackOverflowConfig.API_User + "?" + pars); StackOverflow_User_ResultEntity outmo = null; var jo = result.ToJObject(); if (jo.ContainsKey("items")) { outmo = LoginBase.ResultOutput <StackOverflow_User_ResultEntity>(jo["items"][0].ToJson()); } return(outmo); }
/// <summary> /// Step1:请求用户授权Token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(Taobao_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { TaobaoConfig.API_Authorize, "?response_type=", entity.response_type, "&client_id=", entity.client_id, "&redirect_uri=", entity.redirect_uri.ToEncode(), "&state=", entity.state, "&view=", entity.view })); }
public ActionResult LoginSubmit(string username, string password, string remember) { LoginBaseDto d1 = LoginService.Get(username, password); if (d1 != null) { if (d1.IsExamine == "False") { ViewBag.Title = "您尚未通过审核"; return(View("Login")); } else { if (remember == "true") { HttpCookie Cookie = new HttpCookie("Username"); Cookie.Expires = DateTime.Now.AddDays(3); Cookie.Value = HttpUtility.UrlEncode(username, Encoding.GetEncoding("utf-8")); Response.AppendCookie(Cookie); } //Session["userbase"] = d1; UserInfo user = new UserInfo(); user.ID = d1.ID; user.userName = d1.Name; user.RealName = d1.Real_Name; user.Email = d1.Email; user.Image = d1.Image; user.RoleId = d1.U_Role; user.RoleCode = d1.Code; user.motto = d1.Motto; user.Regist_Time = d1.Register_Time; user.IsNotice = d1.IsNotice; LoginBase.SetSession(user); return(RedirectToAction("Sign_Show", "YSL_Sign_In")); } } ViewBag.Title = "用户名或密码错误"; return(View("Login")); }
private LoginBase CreateLogin() { LoginBase login = null; var uri = this._parameters.BoxUrl; var password = this._optionalParameters?.Password; var username = this._optionalParameters?.Username; if (username != null) { login = new UserBasedLogin(uri, username, password); } else if (password != null) { login = new PasswordBasedLogin(uri, password); } else { login = new AnonymousLogin(uri); } return(login); }
public ActionResult Logout() { LoginBase.logoutSession(); return(View("Login")); }
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, LoginBase serviceImpl) { serviceBinder.AddMethod(__Method_GetUserToken, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::UserTokenRequest, global::UserToken>(serviceImpl.GetUserToken)); serviceBinder.AddMethod(__Method_Logout, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::UserToken, global::LogoutResult>(serviceImpl.Logout)); }
/// <summary>Creates service definition that can be registered with a server</summary> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static grpc::ServerServiceDefinition BindService(LoginBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetUserToken, serviceImpl.GetUserToken) .AddMethod(__Method_Logout, serviceImpl.Logout).Build()); }