コード例 #1
0
        public void Should_add()
        {
            initEmpty();
            Authenticate authenticate = new Authenticate(new AuthenticateId("150"), "login_add", Role.librarian);

            Assert.IsTrue(authenticator.Add(authenticate, "password"));
        }
コード例 #2
0
        private void init()
        {
            AuthenticateInMemoryAdapter authenticateInMemoryAdapter = new AuthenticateInMemoryAdapter();

            authenticator = new AuthenticateInMemoryImpl(authenticateInMemoryAdapter);

            Authenticate authenticate0 = new Authenticate(new AuthenticateId("0"), "login0", Role.librarian);

            authenticator.Add(authenticate0, "password0");

            Authenticate authenticate1 = new Authenticate(new AuthenticateId("1"), "login1", Role.librarian);

            authenticator.Add(authenticate1, "password1");

            Authenticate authenticate2 = new Authenticate(new AuthenticateId("2"), "login2", Role.librarian);

            authenticator.Add(authenticate2, "password2");
        }
コード例 #3
0
        public bool Add(UserDto userDto, string motDePasse)
        {
            if (null != userDto &&
                null != motDePasse &&
                !"".Equals(motDePasse))
            {
                /* On crée les identifiants */
                AuthenticateId authenticateId = authenticateIdGenerator.GenerateId();
                bool           result         = authenticateData.Add(new Authenticate(authenticateId, userDto.Login, userDto.Role), motDePasse);

                if (!result)
                {
                    return(result);
                }

                /* On crée l'utilisateur */
                UserId userId = userIdGenerator.GenerateId();

                return(userData.Add(userDtoAdapter.DtoToModel(userDto, userId, authenticateId)));
            }
            return(false);
        }