Esempio n. 1
0
        internal override void BuildInternal()
        {
            Protobuf.ResponseAuthenticationToken.Builder authenticationTokenBuilder = _authenticationResponseBuilder.AuthenticationToken.ToBuilder();
            if (ServerToken != null)
            {
                if (ServerToken.Token != null)
                {
                    authenticationTokenBuilder.Token = Google.ProtocolBuffers.ByteString.CopyFrom(ServerToken.Token);
                }
                else
                {
                    authenticationTokenBuilder.Token = Google.ProtocolBuffers.ByteString.CopyFrom(new byte[0]);
                }
                authenticationTokenBuilder.Status = (int)ServerToken.Status;
            }
            else
            {
                authenticationTokenBuilder.Token = Google.ProtocolBuffers.ByteString.CopyFrom(new byte[0]);
            }

            _authenticationResponseBuilder.SetAuthenticationToken(authenticationTokenBuilder.Build());

            base._response.SetAuthenticationResponse(_authenticationResponseBuilder);
            base._response.SetType(Alachisoft.NosDB.Common.Protobuf.Response.Types.Type.AUTHENTICATION);
        }
Esempio n. 2
0
        public AuthenticationResponse(Alachisoft.NosDB.Common.Protobuf.Response response)
            : base(response.ToBuilder())
        {
            ServerToken = new AuthToken();

            _authenticationResponseBuilder = response.ToBuilder().AuthenticationResponse.ToBuilder();

            Protobuf.ResponseAuthenticationToken.Builder authenticationTokenBuilder = _authenticationResponseBuilder.AuthenticationToken.ToBuilder();

            ServerToken.Token  = authenticationTokenBuilder.Token.ToByteArray();
            ServerToken.Status = (SecurityStatus)authenticationTokenBuilder.Status;

            base.ResponseMessage = this;
        }