Compare commits

..

2 Commits

Author SHA1 Message Date
Attack825
ad240a373f feat: fix non-standard CAS bug (#4146) 2025-09-03 20:20:08 +08:00
amaankm
01000f7022 feat: update parameter descriptions in Session API (#4140) 2025-09-02 16:31:06 +08:00
5 changed files with 58 additions and 24 deletions

View File

@@ -68,7 +68,7 @@ func (c *ApiController) GetSessions() {
// @Title GetSingleSession // @Title GetSingleSession
// @Tag Session API // @Tag Session API
// @Description Get session for one user in one application. // @Description Get session for one user in one application.
// @Param id query string true "The id(organization/application/user) of session" // @Param sessionPkId query string true "The id(organization/user/application) of session"
// @Success 200 {array} string The Response object // @Success 200 {array} string The Response object
// @router /get-session [get] // @router /get-session [get]
func (c *ApiController) GetSingleSession() { func (c *ApiController) GetSingleSession() {
@@ -87,7 +87,7 @@ func (c *ApiController) GetSingleSession() {
// @Title UpdateSession // @Title UpdateSession
// @Tag Session API // @Tag Session API
// @Description Update session for one user in one application. // @Description Update session for one user in one application.
// @Param id query string true "The id(organization/application/user) of session" // @Param id query string true "The id(organization/user/application) of session"
// @Success 200 {array} string The Response object // @Success 200 {array} string The Response object
// @router /update-session [post] // @router /update-session [post]
func (c *ApiController) UpdateSession() { func (c *ApiController) UpdateSession() {
@@ -106,7 +106,7 @@ func (c *ApiController) UpdateSession() {
// @Title AddSession // @Title AddSession
// @Tag Session API // @Tag Session API
// @Description Add session for one user in one application. If there are other existing sessions, join the session into the list. // @Description Add session for one user in one application. If there are other existing sessions, join the session into the list.
// @Param id query string true "The id(organization/application/user) of session" // @Param id query string true "The id(organization/user/application) of session"
// @Param sessionId query string true "sessionId to be added" // @Param sessionId query string true "sessionId to be added"
// @Success 200 {array} string The Response object // @Success 200 {array} string The Response object
// @router /add-session [post] // @router /add-session [post]
@@ -126,7 +126,7 @@ func (c *ApiController) AddSession() {
// @Title DeleteSession // @Title DeleteSession
// @Tag Session API // @Tag Session API
// @Description Delete session for one user in one application. // @Description Delete session for one user in one application.
// @Param id query string true "The id(organization/application/user) of session" // @Param id query string true "The id(organization/user/application) of session"
// @Success 200 {array} string The Response object // @Success 200 {array} string The Response object
// @router /delete-session [post] // @router /delete-session [post]
func (c *ApiController) DeleteSession() { func (c *ApiController) DeleteSession() {
@@ -145,7 +145,7 @@ func (c *ApiController) DeleteSession() {
// @Title IsSessionDuplicated // @Title IsSessionDuplicated
// @Tag Session API // @Tag Session API
// @Description Check if there are other different sessions for one user in one application. // @Description Check if there are other different sessions for one user in one application.
// @Param id query string true "The id(organization/application/user) of session" // @Param sessionPkId query string true "The id(organization/user/application) of session"
// @Param sessionId query string true "sessionId to be checked" // @Param sessionId query string true "sessionId to be checked"
// @Success 200 {array} string The Response object // @Success 200 {array} string The Response object
// @router /is-session-duplicated [get] // @router /is-session-duplicated [get]

View File

@@ -67,6 +67,14 @@ type CasAttributes struct {
LongTermAuthenticationRequestTokenUsed bool `xml:"cas:longTermAuthenticationRequestTokenUsed"` LongTermAuthenticationRequestTokenUsed bool `xml:"cas:longTermAuthenticationRequestTokenUsed"`
IsFromNewLogin bool `xml:"cas:isFromNewLogin"` IsFromNewLogin bool `xml:"cas:isFromNewLogin"`
MemberOf []string `xml:"cas:memberOf"` MemberOf []string `xml:"cas:memberOf"`
FirstName string `xml:"cas:firstName,omitempty"`
LastName string `xml:"cas:lastName,omitempty"`
Title string `xml:"cas:title,omitempty"`
Email string `xml:"cas:email,omitempty"`
Affiliation string `xml:"cas:affiliation,omitempty"`
Avatar string `xml:"cas:avatar,omitempty"`
Phone string `xml:"cas:phone,omitempty"`
DisplayName string `xml:"cas:displayName,omitempty"`
UserAttributes *CasUserAttributes UserAttributes *CasUserAttributes
ExtraAttributes []*CasAnyAttribute `xml:",any"` ExtraAttributes []*CasAnyAttribute `xml:",any"`
} }
@@ -240,6 +248,24 @@ func GenerateCasToken(userId string, service string) (string, error) {
} else { } else {
value = escapedValue value = escapedValue
} }
switch k {
case "firstName":
authenticationSuccess.Attributes.FirstName = value
case "lastName":
authenticationSuccess.Attributes.LastName = value
case "title":
authenticationSuccess.Attributes.Title = value
case "email":
authenticationSuccess.Attributes.Email = value
case "affiliation":
authenticationSuccess.Attributes.Affiliation = value
case "avatar":
authenticationSuccess.Attributes.Avatar = value
case "phone":
authenticationSuccess.Attributes.Phone = value
case "displayName":
authenticationSuccess.Attributes.DisplayName = value
}
authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{ authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{
Name: k, Name: k,
Value: value, Value: value,

View File

@@ -638,7 +638,7 @@
{ {
"in": "query", "in": "query",
"name": "id", "name": "id",
"description": "The id(organization/application/user) of session", "description": "The id(organization/user/application) of session",
"required": true, "required": true,
"type": "string" "type": "string"
}, },
@@ -1448,7 +1448,7 @@
{ {
"in": "query", "in": "query",
"name": "id", "name": "id",
"description": "The id(organization/application/user) of session", "description": "The id(organization/user/application) of session",
"required": true, "required": true,
"type": "string" "type": "string"
} }
@@ -3318,8 +3318,8 @@
"parameters": [ "parameters": [
{ {
"in": "query", "in": "query",
"name": "id", "name": "sessionPkId",
"description": "The id(organization/application/user) of session", "description": "The id(organization/user/application) of session",
"required": true, "required": true,
"type": "string" "type": "string"
} }
@@ -4034,8 +4034,8 @@
"parameters": [ "parameters": [
{ {
"in": "query", "in": "query",
"name": "id", "name": "sessionPkId",
"description": "The id(organization/application/user) of session", "description": "The id(organization/user/application) of session",
"required": true, "required": true,
"type": "string" "type": "string"
}, },
@@ -5457,7 +5457,7 @@
{ {
"in": "query", "in": "query",
"name": "id", "name": "id",
"description": "The id(organization/application/user) of session", "description": "The id(organization/user/application) of session",
"required": true, "required": true,
"type": "string" "type": "string"
} }

View File

@@ -413,7 +413,7 @@ paths:
parameters: parameters:
- in: query - in: query
name: id name: id
description: The id(organization/application/user) of session description: The id(organization/user/application) of session
required: true required: true
type: string type: string
- in: query - in: query
@@ -935,7 +935,7 @@ paths:
parameters: parameters:
- in: query - in: query
name: id name: id
description: The id(organization/application/user) of session description: The id(organization/user/application) of session
required: true required: true
type: string type: string
responses: responses:
@@ -2159,8 +2159,8 @@ paths:
operationId: ApiController.GetSingleSession operationId: ApiController.GetSingleSession
parameters: parameters:
- in: query - in: query
name: id name: sessionPkId
description: The id(organization/application/user) of session description: The id(organization/user/application) of session
required: true required: true
type: string type: string
responses: responses:
@@ -2629,8 +2629,8 @@ paths:
operationId: ApiController.IsSessionDuplicated operationId: ApiController.IsSessionDuplicated
parameters: parameters:
- in: query - in: query
name: id name: sessionPkId
description: The id(organization/application/user) of session description: The id(organization/user/application) of session
required: true required: true
type: string type: string
- in: query - in: query
@@ -3567,7 +3567,7 @@ paths:
parameters: parameters:
- in: query - in: query
name: id name: id
description: The id(organization/application/user) of session description: The id(organization/user/application) of session
required: true required: true
type: string type: string
responses: responses:

View File

@@ -20,26 +20,34 @@ module.exports = {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
}, },
"/cas/serviceValidate": { "/cas/**/serviceValidate": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
}, },
"/cas/proxyValidate": { "/cas/**/proxyValidate": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
}, },
"/cas/proxy": { "/cas/**/proxy": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
}, },
"/cas/validate": { "/cas/**/validate": {
target: "http://localhost:8000",
changeOrigin: true,
},
"/cas/**/p3/serviceValidate": {
target: "http://localhost:8000",
changeOrigin: true,
},
"/cas/**/p3/proxyValidate": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
}, },
"/scim": { "/scim": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
} },
}, },
}, },
plugins: [ plugins: [