/// <summary> /// The string to pass as the assoc_type value in the OpenID protocol. /// </summary> /// <param name="protocol">The protocol version of the message that the assoc_type value will be included in.</param> /// <returns>The value that should be used for the openid.assoc_type parameter.</returns> internal abstract string GetAssociationType(Protocol protocol);
/// <summary> /// Gets the OpenID protocol instance for the version in a message. /// </summary> /// <param name="message">The message.</param> /// <returns>The OpenID protocol instance.</returns> internal static Protocol GetProtocol(this IProtocolMessage message) { Requires.NotNull(message, "message"); return(Protocol.Lookup(message.Version)); }
/// <summary> /// Determines whether a named association fits the security requirements. /// </summary> /// <param name="protocol">The protocol carrying the association.</param> /// <param name="associationType">The value of the openid.assoc_type parameter.</param> /// <returns> /// <c>true</c> if the association is permitted given the security requirements; otherwise, <c>false</c>. /// </returns> internal bool IsAssociationInPermittedRange(Protocol protocol, string associationType) { int lengthInBits = HmacShaAssociation.GetSecretLength(protocol, associationType) * 8; return(lengthInBits >= this.MinimumHashBitLength && lengthInBits <= this.MaximumHashBitLength); }