Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iotgateway
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
0Tyler
iotgateway
Commits
517438af
Commit
517438af
authored
May 13, 2019
by
0Tyler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
username to account
parent
f7df64d9
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
141 additions
and
155 deletions
+141
-155
.idea/workspace.xml
.idea/workspace.xml
+126
-140
cloud/src/main/java/edu/prlab/tyler/iotgateway/cloud/config/DefaultData.java
.../edu/prlab/tyler/iotgateway/cloud/config/DefaultData.java
+1
-1
cloud/src/main/java/edu/prlab/tyler/iotgateway/cloud/pojo/auth/User.java
...java/edu/prlab/tyler/iotgateway/cloud/pojo/auth/User.java
+1
-1
cloud/src/test/java/edu/prlab/tyler/iotgateway/cloud/CloudHttpApiTest.java
...va/edu/prlab/tyler/iotgateway/cloud/CloudHttpApiTest.java
+1
-1
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/config/DefaultData.class
...u/prlab/tyler/iotgateway/gateway/config/DefaultData.class
+0
-0
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/repositories/UserRepository.class
...yler/iotgateway/gateway/repositories/UserRepository.class
+0
-0
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/services/UserService.class
...prlab/tyler/iotgateway/gateway/services/UserService.class
+0
-0
gateway/out/test/classes/edu/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.class
...u/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.class
+0
-0
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/config/DefaultData.java
...du/prlab/tyler/iotgateway/gateway/config/DefaultData.java
+1
-1
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/pojo/auth/SensitiveUser.java
...lab/tyler/iotgateway/gateway/pojo/auth/SensitiveUser.java
+1
-1
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/repositories/UserRepository.java
...tyler/iotgateway/gateway/repositories/UserRepository.java
+2
-2
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/services/UserService.java
.../prlab/tyler/iotgateway/gateway/services/UserService.java
+5
-5
gateway/src/test/java/edu/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.java
...du/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.java
+3
-3
No files found.
.idea/workspace.xml
View file @
517438af
This diff is collapsed.
Click to expand it.
cloud/src/main/java/edu/prlab/tyler/iotgateway/cloud/config/DefaultData.java
View file @
517438af
...
...
@@ -37,7 +37,7 @@ public class DefaultData implements ApplicationRunner {
public
void
run
(
ApplicationArguments
args
)
{
// User user = User.builder()
// .
username
("test")
// .
account
("test")
// .password("test")
// .build();
// sensitiveUserService.add(user);
...
...
cloud/src/main/java/edu/prlab/tyler/iotgateway/cloud/pojo/auth/User.java
View file @
517438af
...
...
@@ -20,7 +20,7 @@ public class User {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
long
id
;
private
String
username
;
private
String
account
;
private
String
password
;
// private BigInteger publicKey;
...
...
cloud/src/test/java/edu/prlab/tyler/iotgateway/cloud/CloudHttpApiTest.java
View file @
517438af
...
...
@@ -179,7 +179,7 @@ public class CloudHttpApiTest {
PrivacyChoice
privacyChoice
=
PrivacyChoice
.
builder
()
.
privacyContent
(
PrivacyContent
.
builder
()
.
user
(
User
.
builder
()
.
username
(
"test"
)
.
account
(
"test"
)
.
password
(
"test"
)
.
build
())
.
device
(
device
)
...
...
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/config/DefaultData.class
View file @
517438af
No preview for this file type
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/repositories/UserRepository.class
View file @
517438af
No preview for this file type
gateway/out/production/classes/edu/prlab/tyler/iotgateway/gateway/services/UserService.class
View file @
517438af
No preview for this file type
gateway/out/test/classes/edu/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.class
View file @
517438af
No preview for this file type
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/config/DefaultData.java
View file @
517438af
...
...
@@ -16,7 +16,7 @@ public class DefaultData implements ApplicationRunner {
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
SensitiveUser
defaultUser
=
userService
.
registerNewUser
(
SensitiveUser
.
builder
().
username
(
"testUser0"
).
password
(
"testUser0"
).
build
()).
get
();
SensitiveUser
defaultUser
=
userService
.
registerNewUser
(
SensitiveUser
.
builder
().
account
(
"testUser0"
).
password
(
"testUser0"
).
build
()).
get
();
System
.
out
.
println
(
defaultUser
.
toString
());
}
}
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/pojo/auth/SensitiveUser.java
View file @
517438af
...
...
@@ -22,7 +22,7 @@ public class SensitiveUser {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@JsonIgnore
private
long
id
;
private
String
username
;
private
String
account
;
private
String
password
;
// private BigInteger publicKey;
// private BigInteger privateKey;
...
...
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/repositories/UserRepository.java
View file @
517438af
...
...
@@ -5,6 +5,6 @@ import org.springframework.data.repository.CrudRepository;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
UserRepository
extends
CrudRepository
<
SensitiveUser
,
Long
>
{
SensitiveUser
findUserBy
Username
(
String
username
);
boolean
existsBy
Username
(
String
username
);
SensitiveUser
findUserBy
Account
(
String
account
);
boolean
existsBy
Account
(
String
account
);
}
gateway/src/main/java/edu/prlab/tyler/iotgateway/gateway/services/UserService.java
View file @
517438af
...
...
@@ -20,16 +20,16 @@ public class UserService {
//需要增加加密機制
public
Optional
<
SensitiveUser
>
registerNewUser
(
SensitiveUser
user
)
{
return
Optional
.
ofNullable
(
user
)
.
map
(
SensitiveUser:
:
get
Username
)
.
filter
(
username
->!
userRepository
.
existsByUsername
(
username
))
.
map
(
username
->
userRepository
.
save
(
user
));
.
map
(
SensitiveUser:
:
get
Account
)
.
filter
(
account
->!
userRepository
.
existsByAccount
(
account
))
.
map
(
account
->
userRepository
.
save
(
user
));
}
//TODO
//需要增加解密確認
public
Optional
<
SensitiveUser
>
login
(
SensitiveUser
user
)
{
return
Optional
.
ofNullable
(
user
.
get
Username
())
.
map
(
username
->
userRepository
.
findUserByUsername
(
username
))
return
Optional
.
ofNullable
(
user
.
get
Account
())
.
map
(
account
->
userRepository
.
findUserByAccount
(
account
))
.
filter
(
sensitiveUser
->
sensitiveUser
.
getPassword
().
equals
(
user
.
getPassword
()));
}
}
gateway/src/test/java/edu/prlab/tyler/iotgateway/gateway/GatewayHttpApiTest.java
View file @
517438af
...
...
@@ -51,7 +51,7 @@ public class GatewayHttpApiTest {
.
post
(
"/login"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8
)
.
accept
(
MediaType
.
APPLICATION_JSON_UTF8
)
.
content
(
mapper
.
writeValueAsString
(
SensitiveUser
.
builder
().
username
(
"testUser0"
).
password
(
"testUser0"
).
build
())))
.
content
(
mapper
.
writeValueAsString
(
SensitiveUser
.
builder
().
account
(
"testUser0"
).
password
(
"testUser0"
).
build
())))
.
andDo
(
print
())
.
andExpect
(
status
().
isOk
())
.
andReturn
();
...
...
@@ -74,7 +74,7 @@ public class GatewayHttpApiTest {
.
post
(
"/device/"
+
"a1252c49-4188-4e6d-a32e-66604c664fb8"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8
)
.
accept
(
MediaType
.
APPLICATION_JSON_UTF8
)
.
content
(
mapper
.
writeValueAsString
(
SensitiveUser
.
builder
().
username
(
"testUser0"
).
password
(
"testUser0"
).
build
())))
.
content
(
mapper
.
writeValueAsString
(
SensitiveUser
.
builder
().
account
(
"testUser0"
).
password
(
"testUser0"
).
build
())))
.
andDo
(
print
())
.
andExpect
(
status
().
isOk
())
.
andReturn
();
...
...
@@ -96,7 +96,7 @@ public class GatewayHttpApiTest {
PrivacyChoice
privacyChoice
=
PrivacyChoice
.
builder
()
.
privacyContent
(
PrivacyContent
.
builder
()
.
user
(
User
.
builder
()
.
username
(
"test"
)
.
account
(
"test"
)
.
password
(
"test"
)
.
build
())
.
device
(
device
)
...
...
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