Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jan Hrabal
jh-boot
Commits
9dc39721
Commit
9dc39721
authored
Sep 20, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e3e3232c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
2 deletions
+77
-2
data.sql
sql/data.sql
+4
-0
init.sql
sql/init.sql
+6
-0
AppUser.java
src/main/java/com/jh/boot/security/model/AppUser.java
+56
-0
AppUserRepository.java
...va/com/jh/boot/security/repository/AppUserRepository.java
+7
-0
AppUserAuthService.java
...java/com/jh/boot/security/service/AppUserAuthService.java
+4
-0
Page.java
src/main/java/com/jh/boot/web/list/Page.java
+0
-2
No files found.
sql/data.sql
View file @
9dc39721
-- default admin user
insert
into
APP_ROLE
(
ID
,
NAME
)
values
(
1
,
'ADMIN'
);
insert
into
APP_ROLE
(
ID
,
NAME
)
values
(
2
,
'MANAGER'
);
insert
into
APP_ROLE
(
ID
,
NAME
)
values
(
3
,
'CONTRACTOR'
);
insert
into
APP_ROLE
(
ID
,
NAME
)
values
(
4
,
'CONTRACTOR_ADMIN'
);
insert
into
APP_USER
(
ID
,
EMAIL
,
FIRST_NAME
,
LAST_NAME
,
PASSWORD
,
PASSWORD_SALT
,
LOCALE
,
TIMEZONE_ID
)
VAlUES
(
1
,
'janhrabal@seznam.cz'
,
'Jan'
,
'Hrabal'
,
'NKz1rz7kSEBXFGbolvEhdomvcDQYmD0IKGADVpuoxL1ztsE1NAnOMvbiSkvc3vwLQvBdPHw449XzgRderNJc9MMnnMTEgJdl3S6dtBGiEYDRHK19toXdwttfaDrXewjyZBJkzy7CxE/BOad4XkiTreIFAUGRedK9TGZ+RWbrJ2KIRrkSX3H1J2eT7HLF8bblkxz2qhjsF5s0k37e3sFI0xAdyCy6qAYS4/MW4WYQ3o0YyZc4krGE2k3y9kfPxWEh/favQKoFIX92ZkRh6ZIXNF7i4oUBl1pcg6r5ykCT83IAWm9avM768NEitEVOx0V8P0PQ2WxGA3n7nicKmwYjow=='
,
'GACR2Rea1kIhZAlImqK8HauZwTah5eMyKiTzr9HDriryN92YkE5UkWe3Gn7oRLkKEftaNfEfa2Ujj18Rrsed2a6QN69UZCkpRHnwgoBp5ckOOaC6s4undHSjYZW5rJx8CuKXTJpO1TS1LlsjwCyir8oA2gGm480jgGwOefm+r2s='
,
'en'
,
'UTC'
);
insert
into
APP_USER_ROLE
(
USER_ID
,
ROLE_ID
)
values
(
1
,
1
);
...
...
sql/init.sql
View file @
9dc39721
...
...
@@ -81,6 +81,12 @@ CREATE TABLE APP_USER (
TIMEZONE_ID
VARCHAR
(
50
),
LOCALE
VARCHAR
(
50
),
ACCOUNT_ENABLED
BOOLEAN
DEFAULT
TRUE
,
ACCOUNT_EXPIRED
BOOLEAN
DEFAULT
FALSE
,
ACCOUNT_LOCKED
BOOLEAN
DEFAULT
FALSE
,
PASSWORD_EXPIRED
BOOLEAN
DEFAULT
FALSE
,
PASSWORD_CHANGED
TIMESTAMP
,
CONSTRAINT
PK_APP_USER
PRIMARY
KEY
(
ID
)
);
CREATE
INDEX
APP_USER_EMAIL_IDX
ON
APP_USER
(
lower
(
EMAIL
));
...
...
src/main/java/com/jh/boot/security/model/AppUser.java
View file @
9dc39721
...
...
@@ -4,6 +4,7 @@
*/
package
com
.
jh
.
boot
.
security
.
model
;
import
java.util.Date
;
import
java.util.Set
;
import
javax.persistence.Column
;
...
...
@@ -72,6 +73,21 @@ public class AppUser extends AbstractIdEntity {
@Column
(
name
=
"TIMEZONE_ID"
)
private
String
timezone
;
@Column
(
name
=
"ACCOUNT_ENABLED"
)
private
boolean
accountEnabled
;
@Column
(
name
=
"ACCOUNT_EXPIRED"
)
private
boolean
accountExpired
;
@Column
(
name
=
"ACCOUNT_LOCKED"
)
private
boolean
accountLocked
;
@Column
(
name
=
"PASSWORD_EXPIRED"
)
private
boolean
passwordExpired
;
@Column
(
name
=
"PASSWORD_CHANGED"
)
private
Date
passwordChanged
;
/**
* Gets the email.
*
...
...
@@ -222,4 +238,44 @@ public class AppUser extends AbstractIdEntity {
this
.
timezone
=
timezone
;
}
public
boolean
isAccountEnabled
()
{
return
accountEnabled
;
}
public
void
setAccountEnabled
(
boolean
accountEnabled
)
{
this
.
accountEnabled
=
accountEnabled
;
}
public
boolean
isAccountExpired
()
{
return
accountExpired
;
}
public
void
setAccountExpired
(
boolean
accountExpired
)
{
this
.
accountExpired
=
accountExpired
;
}
public
boolean
isAccountLocked
()
{
return
accountLocked
;
}
public
void
setAccountLocked
(
boolean
accountLocked
)
{
this
.
accountLocked
=
accountLocked
;
}
public
boolean
isPasswordExpired
()
{
return
passwordExpired
;
}
public
void
setPasswordExpired
(
boolean
passwordExpired
)
{
this
.
passwordExpired
=
passwordExpired
;
}
public
Date
getPasswordChanged
()
{
return
passwordChanged
;
}
public
void
setPasswordChanged
(
Date
passwordChanged
)
{
this
.
passwordChanged
=
passwordChanged
;
}
}
src/main/java/com/jh/boot/security/repository/AppUserRepository.java
View file @
9dc39721
package
com
.
jh
.
boot
.
security
.
repository
;
import
java.util.Date
;
import
javax.persistence.Query
;
import
org.springframework.util.StringUtils
;
...
...
@@ -46,6 +48,11 @@ public class AppUserRepository extends AbstractHibernateRepository {
user
.
setPassword
(
hash
.
getHash
());
user
.
setPasswordSalt
(
hash
.
getSalt
());
user
.
setAccountEnabled
(
true
);
user
.
setAccountExpired
(
false
);
user
.
setPasswordChanged
(
new
Date
());
user
.
setPasswordExpired
(
false
);
entityManager
.
persist
(
user
);
return
user
;
...
...
src/main/java/com/jh/boot/security/service/AppUserAuthService.java
View file @
9dc39721
...
...
@@ -115,6 +115,9 @@ public class AppUserAuthService implements AuthService {
PasswordHash
hash
=
PasswordUtils
.
hashPassword
(
newPassword
);
user
.
setPassword
(
hash
.
getHash
());
user
.
setPasswordSalt
(
hash
.
getSalt
());
user
.
setPasswordChanged
(
new
Date
());
user
.
setPasswordExpired
(
false
);
}
...
...
@@ -130,6 +133,7 @@ public class AppUserAuthService implements AuthService {
}
user
.
setDeleted
(
true
);
user
.
setAccountEnabled
(
false
);
}
...
...
src/main/java/com/jh/boot/web/list/Page.java
View file @
9dc39721
...
...
@@ -7,8 +7,6 @@ package com.jh.boot.web.list;
import
java.util.Collections
;
import
java.util.List
;
import
com.jh.tsk.model.Contractor
;
/**
* TODO.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment