Search in sources :

Example 6 with Salt

use of edu.stanford.bmir.protege.web.shared.auth.Salt in project webprotege by protegeproject.

the class SaltReadConverterTestCase method shouldConvertBase16LowerCaseStringToSalt.

@Test
public void shouldConvertBase16LowerCaseStringToSalt() {
    Salt salt = converter.convert(encodedString.toLowerCase());
    assertThat(salt.getBytes(), is(bytes));
}
Also used : Salt(edu.stanford.bmir.protege.web.shared.auth.Salt) Test(org.junit.Test)

Example 7 with Salt

use of edu.stanford.bmir.protege.web.shared.auth.Salt in project webprotege by protegeproject.

the class SaltReadConverter method convert.

@Override
public Salt convert(String s) {
    BaseEncoding encoding = BaseEncoding.base16();
    byte[] bytes = encoding.decode(s.toUpperCase(Locale.ENGLISH));
    return new Salt(bytes);
}
Also used : Salt(edu.stanford.bmir.protege.web.shared.auth.Salt) BaseEncoding(com.google.common.io.BaseEncoding)

Example 8 with Salt

use of edu.stanford.bmir.protege.web.shared.auth.Salt in project webprotege by protegeproject.

the class SaltReadConverterTestCase method shouldConvertBase16UpperCaseStringToSalt.

@Test
public void shouldConvertBase16UpperCaseStringToSalt() {
    Salt salt = converter.convert(encodedString.toUpperCase());
    assertThat(salt.getBytes(), is(bytes));
}
Also used : Salt(edu.stanford.bmir.protege.web.shared.auth.Salt) Test(org.junit.Test)

Example 9 with Salt

use of edu.stanford.bmir.protege.web.shared.auth.Salt in project webprotege by protegeproject.

the class UserRecordRepository_TestCase method setUp.

@Before
public void setUp() throws Exception {
    client = new MongoClient();
    database = client.getDatabase(MongoTestUtils.getTestDbName());
    recordRepository = new UserRecordRepository(database, new UserRecordConverter());
    userId = UserId.getUserId("JaneDoe");
    userRecord = new UserRecord(userId, "Jane Doe", EMAIL_ADDRESS, "", new Salt("somebytes".getBytes()), new SaltedPasswordDigest("someotherbytes".getBytes()));
}
Also used : MongoClient(com.mongodb.MongoClient) Salt(edu.stanford.bmir.protege.web.shared.auth.Salt) SaltedPasswordDigest(edu.stanford.bmir.protege.web.shared.auth.SaltedPasswordDigest) Before(org.junit.Before)

Aggregations

Salt (edu.stanford.bmir.protege.web.shared.auth.Salt)9 SaltedPasswordDigest (edu.stanford.bmir.protege.web.shared.auth.SaltedPasswordDigest)5 Test (org.junit.Test)3 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)2 Nonnull (javax.annotation.Nonnull)2 BaseEncoding (com.google.common.io.BaseEncoding)1 MongoClient (com.mongodb.MongoClient)1 ChapSession (edu.stanford.bmir.protege.web.shared.auth.ChapSession)1 GetChapSessionResult (edu.stanford.bmir.protege.web.shared.auth.GetChapSessionResult)1 Md5DigestAlgorithmProvider (edu.stanford.bmir.protege.web.shared.auth.Md5DigestAlgorithmProvider)1 PasswordDigestAlgorithm (edu.stanford.bmir.protege.web.shared.auth.PasswordDigestAlgorithm)1 ResetPasswordResult (edu.stanford.bmir.protege.web.shared.chgpwd.ResetPasswordResult)1 CreateUserAccountAction (edu.stanford.bmir.protege.web.shared.user.CreateUserAccountAction)1 UserDetails (edu.stanford.bmir.protege.web.shared.user.UserDetails)1 Before (org.junit.Before)1