示例#1
0
        public Object Clone()
        {
            CASUserInfo newItem = new CASUserInfo();

            newItem.Success    = this.Success;
            newItem.Service    = this.Service;
            newItem.UserName   = this.UserName;
            newItem.ErrorText  = this.ErrorText;
            newItem.Emails     = this.Emails;
            newItem.Attributes = this.Attributes;

            return(newItem);
        }
示例#2
0
 public override CASChangePasswordResult ChangePassword(CASUserInfo users, String password)
 {
     return(new CASChangePasswordResult("Not implemented"));
 }
示例#3
0
        static public CASUserInfo GetUserInfo(String basePath, Uri service, String username)
        {
            if (service != null)
            {
                String tokenFile = Path.Combine(basePath, service.Host + (service.Port != 80 ? "-" + service.Port : "") + "\\{0}.rcode");
                if (!String.IsNullOrEmpty(username) && File.Exists(String.Format(tokenFile, username)))
                {
                    String txt = File.ReadAllText(String.Format(tokenFile, username), Encoding.UTF8);
                    return(Deserialize <CASUserInfo>(txt));
                }
            }

            CASUserInfo   ret  = null;
            DirectoryInfo path = new DirectoryInfo(basePath);

            try
            {
                if (!String.IsNullOrEmpty(username))
                {
                    foreach (FileInfo f in path.GetFiles(username + ".rcode", SearchOption.AllDirectories))
                    {
                        if (ret == null)
                        {
                            try
                            {
                                String txt = File.ReadAllText(f.FullName, Encoding.UTF8);
                                ret = Deserialize <CASUserInfo>(txt);
                            }
                            catch { }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            finally
            {
                path = null;
            }

            if (ret == null)
            {
                ret = new CASUserInfo();
            }

            if (ret.Success)
            {
                //Define o serviço atual
                if (service != null)
                {
                    ret.Service = service;
                }

                //Salva o token copiado
                ret.SaveToFile(basePath);
            }

            return(ret);
        }
示例#4
0
 public abstract CASChangePasswordResult ChangePassword(CASUserInfo userInfo, String password);