Example #1
0
        private static void ValidateLogonto(OpenlogonSignature signature, string logonto)
        {
            SignatureProperty logontoProperty       = GetSignatureProperty(signature, "logonto");
            SignatureProperty requestIssuerProperty = GetSignatureProperty(signature, "RequestIssuer");

            if (logontoProperty != null && requestIssuerProperty != null)
            {
                throw new InvalidOperationException("Invalid signature logonto and RequestIssuer parameters cannot both be set");
            }

            if (logontoProperty == null && requestIssuerProperty == null)
            {
                throw new InvalidOperationException("Invalid signature either logonto or RequestIssuer parameters must be set");
            }

            if (logontoProperty != null)
            {
                String logontoPropertyValue = logontoProperty.Value;
                if (logontoPropertyValue != logonto)
                {
                    throw new ServiceProviderException("Invalid signature logonto parameter does not match expected value. Expected: "
                                                       + logonto + " actual: " + logontoPropertyValue);
                }
            }

            if (requestIssuerProperty != null)
            {
                String requestIssuerValue = requestIssuerProperty.Value;
                if (requestIssuerValue != logonto)
                {
                    throw new ServiceProviderException("Invalid signature RequestIssuer parameter does not match expected value. Expected: "
                                                       + logonto + " actual: " + requestIssuerValue);
                }
            }
        }
Example #2
0
        private static void ValidateVisibleToSignerForSignText(OpensignSignature signature)
        {
            SignatureProperty signtextProperty = signature.SignatureProperties["signtext"];

            if (IsNotSignedXmlDocument(signature) && !signtextProperty.VisibleToSigner)
            {
                throw new ServiceProviderException("Invalid sign signature - the parameter signtext in the signature " +
                                                   "must have the attribute visibleToSigner set to true");
            }
        }