public AuthenticationResponse Authenticate(string authmethod, ChallengeDetails extra) { if (authmethod == WAMP_CRA) { WampCraChallengeDetails challengeDetails = extra.OriginalValue.Deserialize <WampCraChallengeDetails>(); string signature; if (challengeDetails.Salt == null) { signature = WampCraHelpers.Sign(mAuthenticationKey, challengeDetails.Challenge); } else { signature = WampCraHelpers.AuthSignature(challengeDetails.Challenge, mSecret, challengeDetails); } AuthenticationResponse result = new AuthenticationResponse { Signature = signature }; return(result); } else { throw new WampAuthenticationException("don't know how to authenticate using '" + authmethod + "'"); } }
public override void Authenticate(string signature, AuthenticateExtraData extra) { string computedSignature = WampCraHelpers.Sign(Secret, AuthenticationChallenge); if (computedSignature == signature) { IsAuthenticated = true; } else { throw new WampAuthenticationException("signature is invalid", WampErrors.NotAuthorized); } }