fix: 修复CAS不能使用https方式

This commit is contained in:
fit2cloud-chenyw 2024-06-28 13:09:08 +08:00
parent 5fe832e279
commit b2c74d1707
3 changed files with 37 additions and 6 deletions

@ -1 +1 @@
Subproject commit 4999fda62894ac30bb03dd651bd96a4216d0792c
Subproject commit c0417533a3fe5c2efbf3fa673b9f09fbf9437e74

View File

@ -1,4 +1,4 @@
--
--
---- Licensed to the Apache Software Foundation (ASF) under one or more
---- contributor license agreements. See the NOTICE file distributed with
---- this work for additional information regarding copyright ownership.
@ -34,6 +34,7 @@ local schema = {
idp_uri = {type = "string"},
cas_callback_uri = {type = "string"},
logout_uri = {type = "string"},
cas_callback_domain={type="string"}
},
required = {
"idp_uri", "cas_callback_uri", "logout_uri"
@ -52,8 +53,12 @@ function _M.check_schema(conf)
end
local function uri_without_ticket(conf, ctx)
return ctx.var.scheme .. "://" .. ctx.var.host .. ":" ..
ctx.var.server_port .. conf.cas_callback_uri
if conf.cas_callback_domain == nil then
return ctx.var.scheme .. "://" .. ctx.var.host .. ":" ..
ctx.var.server_port .. conf.cas_callback_uri
else
return conf.cas_callback_domain .. conf.cas_callback_uri
end
end
local function get_session_id(ctx)
@ -113,7 +118,7 @@ local function validate(conf, ctx, ticket)
local httpc = http.new()
local res, err = httpc:request_uri(conf.idp_uri ..
"/serviceValidate",
{ query = { ticket = ticket, service = uri_without_ticket(conf, ctx) } })
{ query = { ticket = ticket, service = uri_without_ticket(conf, ctx) }, ssl_verify = false })
if res and res.status == ngx.HTTP_OK and res.body ~= nil then
if core.string.find(res.body, "<cas:authenticationSuccess>") then

View File

@ -0,0 +1,26 @@
package io.dataease.api.permissions.user.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PlatformUser implements Serializable {
@Serial
private static final long serialVersionUID = 2749044307502902368L;
private String account;
private String name;
private String email;
private String phone;
private Integer type;
}