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
// @Tag Session API
// @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
// @router /get-session [get]
func (c *ApiController) GetSingleSession() {
@@ -87,7 +87,7 @@ func (c *ApiController) GetSingleSession() {
// @Title UpdateSession
// @Tag Session API
// @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
// @router /update-session [post]
func (c *ApiController) UpdateSession() {
@@ -106,7 +106,7 @@ func (c *ApiController) UpdateSession() {
// @Title AddSession
// @Tag Session API
// @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"
// @Success 200 {array} string The Response object
// @router /add-session [post]
@@ -126,7 +126,7 @@ func (c *ApiController) AddSession() {
// @Title DeleteSession
// @Tag Session API
// @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
// @router /delete-session [post]
func (c *ApiController) DeleteSession() {
@@ -145,7 +145,7 @@ func (c *ApiController) DeleteSession() {
// @Title IsSessionDuplicated
// @Tag Session API
// @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"
// @Success 200 {array} string The Response object
// @router /is-session-duplicated [get]

View File

@@ -67,6 +67,14 @@ type CasAttributes struct {
LongTermAuthenticationRequestTokenUsed bool `xml:"cas:longTermAuthenticationRequestTokenUsed"`
IsFromNewLogin bool `xml:"cas:isFromNewLogin"`
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
ExtraAttributes []*CasAnyAttribute `xml:",any"`
}
@@ -240,6 +248,24 @@ func GenerateCasToken(userId string, service string) (string, error) {
} else {
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{
Name: k,
Value: value,

View File

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

View File

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

View File

@@ -20,26 +20,34 @@ module.exports = {
target: "http://localhost:8000",
changeOrigin: true,
},
"/cas/serviceValidate": {
"/cas/**/serviceValidate": {
target: "http://localhost:8000",
changeOrigin: true,
},
"/cas/proxyValidate": {
"/cas/**/proxyValidate": {
target: "http://localhost:8000",
changeOrigin: true,
},
"/cas/proxy": {
"/cas/**/proxy": {
target: "http://localhost:8000",
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",
changeOrigin: true,
},
"/scim": {
target: "http://localhost:8000",
changeOrigin: true,
}
},
},
},
plugins: [