예제 #1
0
        public override ReadOnlyCollection <IAuthorizationPolicy> Authenticate(ReadOnlyCollection <IAuthorizationPolicy> authPolicy, Uri listenUri, ref Message message)
        {
            if ((message != null) &&
                (message.Properties != null) &&
                (message.Properties.Security != null) &&
                (message.Properties.Security.TransportToken != null) &&
                (message.Properties.Security.ServiceSecurityContext != null) &&
                (message.Properties.Security.ServiceSecurityContext.AuthorizationPolicies != null))
            {
                List <IAuthorizationPolicy> authPolicies = new List <IAuthorizationPolicy>(message.Properties.Security.ServiceSecurityContext.AuthorizationPolicies);
                foreach (IAuthorizationPolicy policy in message.Properties.Security.TransportToken.SecurityTokenPolicies)
                {
                    authPolicies.Remove(policy);
                }
                authPolicy = authPolicies.AsReadOnly();
            }

            return(_wrappedAuthenticationManager.Authenticate(authPolicy, listenUri, ref message));
        }
예제 #2
0
        public override ReadOnlyCollection <IAuthorizationPolicy> Authenticate(ReadOnlyCollection <IAuthorizationPolicy> authPolicy, Uri listenUri, ref Message message)
        {
            if (CanSkipAuthentication(message))
            {
                return(authPolicy);
            }

            if (_filteredActionUriCollection != null)
            {
                for (int i = 0; i < _filteredActionUriCollection.Length; ++i)
                {
                    if ((message != null) &&
                        (message.Headers != null) &&
                        !string.IsNullOrEmpty(message.Headers.Action) &&
                        (message.Headers.Action == _filteredActionUriCollection[i]))
                    {
                        return(authPolicy);
                    }
                }
            }

            return(_wrappedAuthenticationManager.Authenticate(authPolicy, listenUri, ref message));
        }