Upgrade init password, high level
parent
934f0be6fa
commit
daf3eba704
|
@ -2,10 +2,10 @@
|
|||
|
||||
truncate user_;
|
||||
truncate user_privilege;
|
||||
-- admin, password is admin ( All privileges)
|
||||
-- admin, password is Admin@2013 ( All privileges)
|
||||
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
|
||||
values (21, '29f6004fb1b0466f9572b02bf2ac1be8', now(), 'admin@andaily.com',
|
||||
'$2a$10$XWN7zOvSLDiyxQnX01KMXuf5NTkkuAUtt23YxUMWaIPURcR7bdULi', '028-1234567', 'admin', 1);
|
||||
'$2a$10$bIIt6KqIMweTZZC.IIHBLuN3dEIJL0LQFRPrtWTujn9O3Sl5Us5vW', '028-1234567', 'admin', 1);
|
||||
|
||||
insert into user_privilege(user_id, privilege)
|
||||
values (21, 'ADMIN');
|
||||
|
@ -14,18 +14,18 @@ values (21, 'UNITY');
|
|||
insert into user_privilege(user_id, privilege)
|
||||
values (21, 'MOBILE');
|
||||
|
||||
-- unity, password is unity ( ROLE_UNITY)
|
||||
-- unity, password is Unity#2013 ( ROLE_UNITY)
|
||||
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
|
||||
values (22, '55b713df1c6f423e842ad68668523c49', now(), 'unity@andaily.com',
|
||||
'$2a$10$gq3eUch/h.eHt20LpboSXeeZinzSLBk49K5KD.Ms4/1tOAJIsrrfq', '', 'unity', 0);
|
||||
'$2a$10$M/bdEKNH12ksSmMgt0p3YeSjW4C5auAjE8by9BY6oEkHTjGKNDqTO', '', 'unity', 0);
|
||||
|
||||
insert into user_privilege(user_id, privilege)
|
||||
values (22, 'UNITY');
|
||||
|
||||
-- mobile, password is mobile ( ROLE_MOBILE)
|
||||
-- mobile, password is Mobile*2013 ( ROLE_MOBILE)
|
||||
insert into user_(id, guid, create_time, email, password, phone, username, default_user)
|
||||
values (23, '612025cb3f964a64a48bbdf77e53c2c1', now(), 'mobile@andaily.com',
|
||||
'$2a$10$BOmMzLDaoiIQ4Q1pCw6Z4u0gzL01B8bNL.0WUecJ2YxTtHVRIA8Zm', '', 'mobile', 0);
|
||||
'$2a$10$MJKW44F.e.UH.54OY36b6eCPpp8KRszL3vAgqLyL1WWnpbGp7A8zW', '', 'mobile', 0);
|
||||
|
||||
insert into user_privilege(user_id, privilege)
|
||||
values (23, 'MOBILE');
|
||||
|
|
|
@ -82,18 +82,18 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>admin</td>
|
||||
<td>admin</td>
|
||||
<td>Admin@2013</td>
|
||||
<td>All privileges, allow visit [Mobile] and [Unity] resources, manage user</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>unity</td>
|
||||
<td>unity</td>
|
||||
<td>Unity#2013</td>
|
||||
<td>Only allow visit [Unity] resource, support grant_type:
|
||||
<em>authorization_code,refresh_token,device_code</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mobile</td>
|
||||
<td>mobile</td>
|
||||
<td>Mobile*2013</td>
|
||||
<td>Only allow visit [Mobile] resource, support grant_type: <em>password,refresh_token</em></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
package com.monkeyk.sos.infrastructure;
|
||||
|
||||
|
||||
import com.monkeyk.sos.ContextTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/*
|
||||
* @author Shengzhao Li
|
||||
*/
|
||||
public class PasswordHandlerTest {
|
||||
public class PasswordHandlerTest extends ContextTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
|
||||
// @Test
|
||||
|
@ -18,4 +26,22 @@ public class PasswordHandlerTest {
|
|||
// assertNotNull(md5);
|
||||
//// System.out.println(md5);
|
||||
// }
|
||||
|
||||
@Test
|
||||
void encode() throws Exception {
|
||||
|
||||
String pwd = "Admin@2013";
|
||||
String encode = PasswordHandler.encode(pwd);
|
||||
assertNotNull(encode);
|
||||
// System.out.println(encode);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void matches() {
|
||||
String pwd = "Admin@2013";
|
||||
boolean matches = passwordEncoder.matches(pwd, "$2a$10$bIIt6KqIMweTZZC.IIHBLuN3dEIJL0LQFRPrtWTujn9O3Sl5Us5vW");
|
||||
assertTrue(matches);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue