File tree 3 files changed +33
-1
lines changed
src/main/java/com/yunionyun/mcp/mcclient/keystone
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
<groupId >com.yunionyun.mcp</groupId >
6
6
<artifactId >mcclient</artifactId >
7
- <version >3.2.19 </version >
7
+ <version >3.2.20 </version >
8
8
<packaging >jar</packaging >
9
9
10
10
<name >${project.groupId} :${project.artifactId} </name >
Original file line number Diff line number Diff line change
1
+ package com .yunionyun .mcp .mcclient .keystone ;
2
+
3
+ import com .alibaba .fastjson .JSONObject ;
4
+
5
+ public class AuthContext {
6
+ private String source ;
7
+ private String ip ;
8
+
9
+ public AuthContext (String source , String ip ) {
10
+ this .source = source ;
11
+ this .ip = ip ;
12
+ }
13
+
14
+ public AuthContext (JSONObject context ) {
15
+ this (context .getString ("source" ), context .getString ("ip" ));
16
+ }
17
+
18
+ public String getSource () {
19
+ return source ;
20
+ }
21
+
22
+ public String getIp () {
23
+ return ip ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public class TokenCredential {
19
19
private Role [] roles ;
20
20
private Service [] services ;
21
21
private Date expires ;
22
+ private AuthContext context ;
22
23
23
24
public TokenCredential (String token ) {
24
25
this .token = token ;
@@ -52,6 +53,8 @@ public void parseJSON(JSONObject result) {
52
53
this .services [i ] = new Service ();
53
54
this .services [i ].parseJSON (serviceJSON .getJSONObject (i ));
54
55
}
56
+ JSONObject context = token .getJSONObject ("context" );
57
+ this .context = new AuthContext (context );
55
58
}
56
59
57
60
public String getToken () {
@@ -90,6 +93,10 @@ public String getProjectName() {
90
93
return this .project .getName ();
91
94
}
92
95
96
+ public AuthContext getContext () {
97
+ return context ;
98
+ }
99
+
93
100
public boolean isValid () {
94
101
Date now = new Date ();
95
102
return this .expires .after (now );
You can’t perform that action at this time.
0 commit comments