Exemplo n.º 1
0
        static void ParseProperty(string key, string value, ref AuthServiceConfig cur)
        {
            if (key.CaselessEq("URL"))
            {
                if (cur != null)
                {
                    configs.Add(cur);
                }

                cur = new AuthServiceConfig()
                {
                    URL = value
                };
            }
            else if (key.CaselessEq("name-suffix"))
            {
                if (cur == null)
                {
                    return;
                }
                cur.NameSuffix = value;
            }
            else if (key.CaselessEq("skin-prefix"))
            {
                if (cur == null)
                {
                    return;
                }
                cur.SkinPrefix = value;
            }
        }
Exemplo n.º 2
0
        static void LoadConfig()
        {
            configs.Clear();

            AuthServiceConfig cur = null;

            PropertiesFile.Read(Paths.AuthServicesFile, ref cur, ParseProperty, '=', true);
            if (cur != null)
            {
                configs.Add(cur);
            }
        }
Exemplo n.º 3
0
        public virtual bool Authenticate(Player p, string mppass)
        {
            bool valid = Authenticator.Current.VerifyLogin(p, mppass, this);

            if (!valid)
            {
                return(false);
            }
            AuthServiceConfig cfg = Config;

            p.verifiedName = true;
            p.SkinName     = cfg.SkinPrefix + p.SkinName;

            p.name        += cfg.NameSuffix;
            p.truename    += cfg.NameSuffix;
            p.DisplayName += cfg.NameSuffix;
            return(true);
        }
Exemplo n.º 4
0
        static AuthServiceConfig GetOrCreateConfig(string url)
        {
            foreach (AuthServiceConfig c in configs)
            {
                if (c.URL.CaselessEq(url))
                {
                    return(c);
                }
            }

            AuthServiceConfig cfg = new AuthServiceConfig()
            {
                URL = url
            };

            configs.Add(cfg);

            try {
                SaveConfig();
            } catch (Exception ex) {
                Logger.LogError("Error saving authservices.properties", ex);
            }
            return(cfg);
        }