Exemple #1
0
        public PvpApplicationLdapAuthorizer(string rootUrl, string userId, LdapConfiguration configuration)
        {
            if (rootUrl == null)
            {
                throw new ArgumentNullException("rootUrl");
            }

            if (userId == null)
            {
                throw new ArgumentNullException("userId");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _application = configuration.GetApplication(rootUrl);
            if (_application != null)
            {
                if (!String.IsNullOrEmpty(_application.DomainPrefix) &&
                    userId.StartsWith(_application.DomainPrefix + @"\", StringComparison.InvariantCultureIgnoreCase))
                {
                    userId = userId.Remove(0, _application.DomainPrefix.Length + 1);
                }
            }
            _userId  = userId;
            _rootUrl = rootUrl;
            _isValid = (_application != null) && _userId != null && User != null &&
                       (!_application.MustHaveRole || !String.IsNullOrEmpty(String.Join(",", _application.GetAttributeValue(PvpAttributes.ROLES, User, Groups))));
        }
Exemple #2
0
 public PvpApplicationLdapAuthorizer(string rootUrl, string userId)
     : this(rootUrl, userId, LdapConfiguration.GetConfiguration())
 {
 }