Exemplo n.º 1
0
        public virtual OAuth2ResourceProvider SetFlow(
            string clientId,
            string clientSecret,
            AuthenticationInterfaceEnum @interface,
            OAuthAppTypeEnum appType)
        {
            ResponseTypeEnum flow;

            if (@interface == AuthenticationInterfaceEnum.Dedicated &&
                appType == OAuthAppTypeEnum.Desktop)
            {
                flow = clientSecret != null ?
                       ResponseTypeEnum.Code :
                       ResponseTypeEnum.Token;
            }
            else if (@interface == AuthenticationInterfaceEnum.Embedded &&
                     appType == OAuthAppTypeEnum.Desktop)
            {
                throw new NotSupportedException(
                          StringResources.EmbeddedDesktopUINotSupportedException);
            }
            else if (@interface == AuthenticationInterfaceEnum.Dedicated &&
                     appType == OAuthAppTypeEnum.Mobile)
            {
                flow = ResponseTypeEnum.Code;
            }
            else if (@interface == AuthenticationInterfaceEnum.Embedded &&
                     appType == OAuthAppTypeEnum.Mobile)
            {
                flow = clientSecret != null ?
                       ResponseTypeEnum.Code :
                       ResponseTypeEnum.Token;
            }
            else
            {
                throw new NotSupportedException();
            }

            if (!Flows.Contains(flow))
            {
                throw new InvalidGrantTypeException(
                          string.Format(
                              StringResources.GrantTypeNotSupportedException,
                              GetType().Name));
            }

            Flow = flow;

            return(this);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到流程树 数据
 /// </summary>
 /// <returns></returns>
 public string GetTreeData()
 {
     //加载流程权限
     if (BP.WF.Glo.OSModel == BP.Sys.OSModel.OneMore)
     {
         StringBuilder sbContent = new StringBuilder("");
         string        sqlSort   = "SELECT No,Name,ParentNo,MenuType,Flag FROM V_GPM_EmpMenu WHERE FK_Emp='" + BP.Web.WebUser.No + "' and FK_App = '" + BP.Sys.SystemConfig.SysNo + "'";
         DataTable     dtSort    = BP.DA.DBAccess.RunSQLReturnTable(sqlSort);
         Flows         fls       = BP.WF.Dev2Interface.DB_GenerCanStartFlowsOfEntities(BP.Web.WebUser.No);
         if (dtSort != null)
         {
             int iCount = 0;
             sbContent.Append("[");
             foreach (DataRow dr in dtSort.Rows)
             {
                 iCount++;
                 sbContent.Append("{");
                 sbContent.AppendFormat("No:\"{0}\",", dr["No"].ToString());
                 sbContent.AppendFormat("Name:\"{0}\",", dr["Name"].ToString());
                 sbContent.AppendFormat("ParentNo:\"{0}\",", dr["ParentNo"].ToString());
                 sbContent.AppendFormat("MenuType:\"{0}\",", dr["MenuType"].ToString());
                 sbContent.AppendFormat("Flag:\"{0}\",", dr["Flag"].ToString());
                 string fk_no = dr["Flag"].ToString().Replace("Flow", "");
                 if (fls.Contains(fk_no) == false)  //判断用户是否具有发起的权限
                 {
                     sbContent.Append("IsStart:\"0\"");
                 }
                 else
                 {
                     sbContent.Append("IsStart:\"1\"");
                 }
                 if (iCount == dtSort.Rows.Count)
                 {
                     sbContent.Append("}");
                 }
                 else
                 {
                     sbContent.Append("},");
                 }
             }
             sbContent.Append("]");
         }
         return(sbContent.ToString());
     }
     return("");
 }