예제 #1
0
        IDictionary <string, string> IExtensionRequest.Serialize(DotNetOpenId.RelyingParty.IAuthenticationRequest authenticationRequest)
        {
            var fields = new Dictionary <string, string>();

            if (MaximumAuthenticationAge.HasValue)
            {
                fields.Add(Constants.RequestParameters.MaxAuthAge,
                           MaximumAuthenticationAge.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            // Even if empty, this parameter is required as part of the request message.
            fields.Add(Constants.RequestParameters.PreferredAuthPolicies, SerializePolicies(PreferredPolicies));

            if (PreferredAuthLevelTypes.Count > 0)
            {
                AliasManager authLevelAliases = new AliasManager();
                authLevelAliases.AssignAliases(PreferredAuthLevelTypes, Constants.AuthenticationLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in authLevelAliases.Aliases)
                {
                    fields.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, authLevelAliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list a preferred order.
                fields.Add(Constants.RequestParameters.PreferredAuthLevelTypes, SerializeAuthLevels(PreferredAuthLevelTypes, authLevelAliases));
            }

            return(fields);
        }
예제 #2
0
        /// <summary>
        /// Called when the message is about to be transmitted,
        /// before it passes through the channel binding elements.
        /// </summary>
        void IMessageWithEvents.OnSending()
        {
            var extraData = ((IMessage)this).ExtraData;

            extraData.Clear();

            this.actualPoliciesString = SerializePolicies(this.ActualPolicies);

            if (this.AssuranceLevels.Count > 0)
            {
                AliasManager aliases = new AliasManager();
                aliases.AssignAliases(this.AssuranceLevels.Keys, Constants.AssuranceLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in aliases.Aliases)
                {
                    extraData.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, aliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list the individual values.
                foreach (var pair in this.AssuranceLevels)
                {
                    extraData.Add(AuthLevelAliasPrefix + aliases.GetAlias(pair.Key), pair.Value);
                }
            }
        }
예제 #3
0
        IDictionary <string, string> IExtensionResponse.Serialize(DotNetOpenId.Provider.IRequest authenticationRequest)
        {
            var fields = new Dictionary <string, string>();

            fields.Add(Constants.ResponseParameters.AuthPolicies, SerializePolicies(ActualPolicies));
            if (AuthenticationTimeUtc.HasValue)
            {
                fields.Add(Constants.ResponseParameters.AuthTime, AuthenticationTimeUtc.Value.ToUniversalTime().ToString(PermissibleDateTimeFormats[0], CultureInfo.InvariantCulture));
            }

            if (AssuranceLevels.Count > 0)
            {
                AliasManager aliases = new AliasManager();
                aliases.AssignAliases(AssuranceLevels.Keys, Constants.AuthenticationLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in aliases.Aliases)
                {
                    fields.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, aliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list the individual values.
                foreach (var pair in AssuranceLevels)
                {
                    fields.Add(Constants.ResponseParameters.AuthLevelAliasPrefix + aliases.GetAlias(pair.Key), pair.Value);
                }
            }

            return(fields);
        }
예제 #4
0
        /// <summary>
        /// Called when the message is about to be transmitted,
        /// before it passes through the channel binding elements.
        /// </summary>
        void IMessageWithEvents.OnSending()
        {
            var extraData = ((IMessage)this).ExtraData;

            extraData.Clear();

            this.preferredPoliciesString = SerializePolicies(this.PreferredPolicies);

            if (this.PreferredAuthLevelTypes.Count > 0)
            {
                AliasManager authLevelAliases = new AliasManager();
                authLevelAliases.AssignAliases(this.PreferredAuthLevelTypes, Constants.AssuranceLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in authLevelAliases.Aliases)
                {
                    extraData.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, authLevelAliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list a preferred order.
                extraData.Add(Constants.RequestParameters.PreferredAuthLevelTypes, SerializeAuthLevels(this.PreferredAuthLevelTypes, authLevelAliases));
            }
        }
예제 #5
0
/// <summary>
/// Called when the message is about to be transmitted,
/// before it passes through the channel binding elements.
/// </summary>
void IMessageWithEvents.OnSending()
{
    var extraData = ((IMessage)this).ExtraData;
            extraData.Clear();

            this.actualPoliciesString = SerializePolicies(this.ActualPolicies);

            if (this.AssuranceLevels.Count > 0) {
                AliasManager aliases = new AliasManager();
                aliases.AssignAliases(this.AssuranceLevels.Keys, Constants.AssuranceLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in aliases.Aliases) {
                    extraData.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, aliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list the individual values.
                foreach (var pair in this.AssuranceLevels) {
                    extraData.Add(AuthLevelAliasPrefix + aliases.GetAlias(pair.Key), pair.Value);
                }
            }
}
예제 #6
0
		#region IExtensionResponse Members

		IDictionary<string, string> IExtensionResponse.Serialize(DotNetOpenId.Provider.IRequest authenticationRequest) {
			var fields = new Dictionary<string, string>();

			fields.Add(Constants.ResponseParameters.AuthPolicies, SerializePolicies(ActualPolicies));
			if (AuthenticationTimeUtc.HasValue) {
				fields.Add(Constants.ResponseParameters.AuthTime, AuthenticationTimeUtc.Value.ToUniversalTime().ToString(PermissibleDateTimeFormats[0], CultureInfo.InvariantCulture));
			}

			if (AssuranceLevels.Count > 0) {
				AliasManager aliases = new AliasManager();
				aliases.AssignAliases(AssuranceLevels.Keys, Constants.AuthenticationLevels.PreferredTypeUriToAliasMap);

				// Add a definition for each Auth Level Type alias.
				foreach (string alias in aliases.Aliases) {
					fields.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, aliases.ResolveAlias(alias));
				}

				// Now use the aliases for those type URIs to list the individual values.
				foreach (var pair in AssuranceLevels) {
					fields.Add(Constants.ResponseParameters.AuthLevelAliasPrefix + aliases.GetAlias(pair.Key), pair.Value);
				}
			}
예제 #7
0
/// <summary>
/// Called when the message is about to be transmitted,
/// before it passes through the channel binding elements.
/// </summary>
void IMessageWithEvents.OnSending()
{
    var extraData = ((IMessage)this).ExtraData;
            extraData.Clear();

            this.preferredPoliciesString = SerializePolicies(this.PreferredPolicies);

            if (this.PreferredAuthLevelTypes.Count > 0) {
                AliasManager authLevelAliases = new AliasManager();
                authLevelAliases.AssignAliases(this.PreferredAuthLevelTypes, Constants.AssuranceLevels.PreferredTypeUriToAliasMap);

                // Add a definition for each Auth Level Type alias.
                foreach (string alias in authLevelAliases.Aliases) {
                    extraData.Add(Constants.AuthLevelNamespaceDeclarationPrefix + alias, authLevelAliases.ResolveAlias(alias));
                }

                // Now use the aliases for those type URIs to list a preferred order.
                extraData.Add(Constants.RequestParameters.PreferredAuthLevelTypes, SerializeAuthLevels(this.PreferredAuthLevelTypes, authLevelAliases));
            }
}