public void AuthenticateParametersArePassedToSessionAuthenticator() { MockSessionAuthenticationFactory mockSessionAuthenticationFactory = new MockSessionAuthenticationFactory(); string receivedSignature = null; AuthenticateExtraData receivedExtraData = null; mockSessionAuthenticationFactory.SetGetSessionAuthenticator ((clientDetails, transportAuthenticator) => { MockSessionAuthenticator mockSessionAuthenticator = new MockSessionAuthenticator(); mockSessionAuthenticator.SetAuthenticationMethod("ticket"); mockSessionAuthenticator.SetAuthenticate((signature, extra) => { receivedSignature = signature; receivedExtraData = extra; }); return(mockSessionAuthenticator); }); WampAuthenticationPlayground playground = new WampAuthenticationPlayground(mockSessionAuthenticationFactory); playground.Host.Open(); string clientAuthMethod = null; ChallengeDetails clientChallengeDetails = null; Mock <IWampClient <JToken> > clientMock = new Mock <IWampClient <JToken> >(); IWampServerProxy serverProxy = playground.CreateRawConnection(clientMock.Object); serverProxy.Hello("realm1", new HelloDetailsHack() { AuthenticationId = "joe", AuthenticationMethods = new string[] { "wampcra", "ticket" } }); serverProxy.Authenticate("Barack Hussein", new MyAuthenticateExtraData() { Wife = "Michelle" }); MyAuthenticateExtraData deserializedExtraData = receivedExtraData.OriginalValue.Deserialize <MyAuthenticateExtraData>(); Assert.That(receivedSignature, Is.EqualTo("Barack Hussein")); Assert.That(deserializedExtraData.Wife, Is.EqualTo("Michelle")); }
public override void Authenticate(string signature, AuthenticateExtraData extra) { if (signature == _mTicket) { IsAuthenticated = true; Authorizer = _authorizer; WelcomeDetails = new WelcomeDetails { AuthenticationProvider = "dynamic", AuthenticationRole = "user" }; } }
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); } }
public override void Authenticate(string signature, AuthenticateExtraData extra) { if (_apiKeyValidator.ValidateAsync(signature).Result) { _sessionRepository.AddSessionId(signature, _details.SessionId); IsAuthenticated = true; WelcomeDetails = new WelcomeDetails { AuthenticationRole = "HFT client" }; Authorizer = TokenAuthorizer.Instance; } }
public override void Authenticate(string signature, AuthenticateExtraData extra) { if (_tokenValidator.Validate(signature)) { _sessionCache.AddSessionId(signature, _details.SessionId); IsAuthenticated = true; WelcomeDetails = new WelcomeDetails { AuthenticationRole = "Lykke client" }; Authorizer = TokenAuthorizer.Instance; } }
public void Challenge(string authMethod, ChallengeDetails extra) { try { AuthenticationResponse response = mAuthenticator.Authenticate(authMethod, extra); AuthenticateExtraData authenticationExtraData = response.Extra ?? EmptyAuthenticateDetails; string authenticationSignature = response.Signature; mServerProxy.Authenticate(authenticationSignature, authenticationExtraData); } catch (WampAuthenticationException ex) { mServerProxy.Abort(ex.Details, ex.Reason); OnConnectionError(ex); } }
public override void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra) { Extra = extra; Signature = signature; }
public override void Authenticate(string signature, AuthenticateExtraData extra) { mAuthenticate(signature, extra); }
public void Authenticate(string signature, AuthenticateExtraData extra) { Send(mAuthenticate2, signature, extra); }
public override void Authenticate(string signature, AuthenticateExtraData extra) { throw new WampAuthenticationException("Cookie wasn't present"); }
/// <summary> /// <see cref="IWampSessionAuthenticator.Authenticate"/> /// </summary> public abstract void Authenticate(string signature, AuthenticateExtraData extra);
public virtual void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra) { // TODO: disconnect client. }
public override void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra) { IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>; IWampSessionAuthenticator authenticator = wampClient.Authenticator; try { authenticator.Authenticate(signature, extra); if (authenticator.IsAuthenticated) { OnClientAuthenticated(wampClient, wampClient.HelloDetails); } else { SendAbort(client, new WampAuthenticationException(new AbortDetails(), WampErrors.AuthorizationFailed)); } } catch (WampAuthenticationException ex) { SendAbort(client, ex); } }
public void Authenticate(string signature, AuthenticateExtraData extra) { mAuthenticator.Authenticate(signature, extra); }
public virtual void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra) { }
public void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra) { throw new System.NotImplementedException(); }
public sealed override void Authenticate(string signature, AuthenticateExtraData extra) { TExtra deserialized = extra.OriginalValue.Deserialize <TExtra>(); Authenticate(signature, deserialized); }