Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elleai
Project
Project
Details
Activity
Releases
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
ai-tech
E
ellehuis-group
backend
elleai
Commits
283c6b10
Commit
283c6b10
authored
Oct 23, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后管授权接口
parent
bc999965
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
397 additions
and
0 deletions
+397
-0
PageRequest.java
...cn/breeze/elleai/application/dto/request/PageRequest.java
+26
-0
UserLoginRequest.java
...eeze/elleai/application/dto/request/UserLoginRequest.java
+26
-0
PagePermissionResult.java
...elleai/application/dto/response/PagePermissionResult.java
+23
-0
UserLoginResult.java
...eeze/elleai/application/dto/response/UserLoginResult.java
+36
-0
AuthController.java
...ava/cn/breeze/elleai/controller/admin/AuthController.java
+265
-0
JwtUtil.java
src/main/java/cn/breeze/elleai/util/JwtUtil.java
+19
-0
UserPrincipal.java
src/main/java/cn/breeze/elleai/util/UserPrincipal.java
+2
-0
No files found.
src/main/java/cn/breeze/elleai/application/dto/request/PageRequest.java
0 → 100644
View file @
283c6b10
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
/**
* 描述:
*
* @Author: fangjh
* @CreateTime: 2023/04/25 14:44:53
*/
@Data
@Schema
(
description
=
"页面请求"
)
public
class
PageRequest
{
@Schema
(
description
=
"entId"
)
private
Integer
entId
;
@Schema
(
description
=
"用户id"
)
private
Long
userId
;
private
Long
id
;
@Schema
(
description
=
"状态"
)
private
Integer
status
;
}
src/main/java/cn/breeze/elleai/application/dto/request/UserLoginRequest.java
0 → 100644
View file @
283c6b10
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author Administrator
*/
@Schema
(
description
=
"登录请求"
)
@Data
public
class
UserLoginRequest
implements
Serializable
{
/**
* 用户名
*/
@Schema
(
description
=
"用户名"
)
private
String
userName
;
@Schema
(
description
=
"登录密码"
)
private
String
password
;
@Schema
(
description
=
"验证码"
)
private
String
verifyCode
;
}
src/main/java/cn/breeze/elleai/application/dto/response/PagePermissionResult.java
0 → 100644
View file @
283c6b10
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* 描述:
*
* @Author: fangjh
* @CreateTime: 2023/04/26 14:04:18
*/
@Data
public
class
PagePermissionResult
implements
Serializable
{
private
Integer
type
;
private
List
<
String
>
channels
;
private
Map
<
String
,
List
<
String
>>
permission
;
}
src/main/java/cn/breeze/elleai/application/dto/response/UserLoginResult.java
0 → 100644
View file @
283c6b10
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author Administrator
*/
@Data
@Schema
(
description
=
"登录结果"
)
public
class
UserLoginResult
implements
Serializable
{
@Schema
(
description
=
"授权token"
)
private
String
token
;
@Schema
(
description
=
"用户id"
)
private
String
userId
;
@Schema
(
description
=
"用户名"
)
private
String
userName
;
@Schema
(
description
=
"昵称"
)
private
String
nickName
;
@Schema
(
description
=
"头像"
)
private
String
avatar
;
@Schema
(
description
=
"是否超级用户"
)
private
Boolean
isSuperUser
;
@Schema
(
description
=
"最后更新时间"
)
private
Date
updateAt
;
}
src/main/java/cn/breeze/elleai/controller/admin/AuthController.java
0 → 100644
View file @
283c6b10
This diff is collapsed.
Click to expand it.
src/main/java/cn/breeze/elleai/util/JwtUtil.java
View file @
283c6b10
package
cn
.
breeze
.
elleai
.
util
;
import
cn.hutool.core.lang.UUID
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.auth0.jwt.JWT
;
...
...
@@ -46,6 +47,7 @@ public class JwtUtil {
principal
.
setShopId
(
shopId
);
principal
.
setShopName
(
shopName
);
principal
.
setJobTitle
(
jobTitle
);
principal
.
setToken
(
token
);
return
principal
;
}
...
...
@@ -77,4 +79,21 @@ public class JwtUtil {
}
}));
}
public
static
String
generateToken
(
String
userName
,
String
password
)
{
String
token
=
null
;
Long
expireTime
=
1000
*
24
*
60
*
60
*
1000L
;
Date
expiresAt
=
new
Date
(
System
.
currentTimeMillis
()+
expireTime
);
token
=
JWT
.
create
()
.
withIssuer
(
"oss"
)
.
withClaim
(
"userId"
,
UUID
.
randomUUID
().
toString
(
true
))
.
withClaim
(
"userName"
,
userName
)
.
withClaim
(
"position"
,
""
)
.
withClaim
(
"jobTitle"
,
""
)
.
withClaim
(
"shopId"
,
""
)
.
withClaim
(
"shopName"
,
""
)
.
withExpiresAt
(
expiresAt
)
.
sign
(
Algorithm
.
HMAC256
(
"mezeron-ai"
));
return
token
;
}
}
src/main/java/cn/breeze/elleai/util/UserPrincipal.java
View file @
283c6b10
...
...
@@ -23,4 +23,6 @@ public class UserPrincipal implements Serializable {
private
String
shopName
;
private
PrincipalEnum
type
;
private
String
token
;
}
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