分类

链接

2025 年 7 月
 123456
78910111213
14151617181920
21222324252627
28293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > Crack, Docker > 正文
共享办公室出租
原创!无插件hack方式实现conflulence open connect sso登陆
Crack, Docker 暂无评论 阅读(4)

 

原创!无插件hack方式实现conflulence open connect sso登陆

原创!无插件hack方式实现conflulence open connect sso登陆

原创!无插件hack方式实现conflulence open connect sso登陆

 

  1. 登陆页面增加sso按钮

按钮跳转页面为SSO登陆页面,例如:

<a href="https://sso.xxx.com/application/o/authorize/?response_type=code&client_id=xxxxxx&redirect_uri=https://confluence.xxx.com/plugins/servlet/sso/callback&scope=openid+profile+email" >Login with SSO</a>

 

2.增加后台

public class OIDCCallbackServlet extends HttpServlet {

    //private static final Logger LOGGER = Logger.getLogger(OIDCCallbackServlet.class.getName());
   
    // 1. 换成你真实的参数
    private static final String TOKEN_URL   = "https://sso.xxx.cn/application/o/token/";
    private static final String USERINFO_URL= "https://sso.xxx.cn/application/o/userinfo/";
    private static final String CLIENT_ID   = "xxxxx";
    private static final String CLIENT_SECRET = "dddddd";
    private static final String REDIRECT_URI  = "https://confluence.xxx.cn/plugins/servlet/sso/callback";

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        String code = req.getParameter("code");
        if (code == null || code.trim().isEmpty()) {
            resp.sendError(400, "缺少 code 参数");
            return;
        }

        try {
             System.out.println("CALLBACK Code: " + code);
            
            
            // 1) 准备请求参数和请求头
            
            // 2) 发送 POST 请求获取 token
         
            // 2) token 换 userinfo
            
            // 将 Principal 对象放入 Seraph 的特定会话属性中 

            req.getSession().setAttribute("seraph_defaultauthenticator_user", principal);
            
             System.out.println("SSO Login SUCCESS");
    
            resp.sendRedirect("/");   // 回到首页
        } catch (Exception e) {
            System.out.println("OIDC Exception: " + e);
            throw new IOException("OIDC 登录失败", e);
        }
    }
 
    
    
     
}

 

3.修改启动类

<!-- ======== -->
   <!-- Servlets -->
   <!-- ======== -->

   <!-- OIDC Callback Servlet -->
   <servlet>
       <servlet-name>OIDCCallbackServlet</servlet-name>
       <servlet-class>com.atlassian.confluence.sso.OIDCCallbackServlet</servlet-class>
       <load-on-startup>10</load-on-startup>
   </servlet>

 

4.查看日志

 

打算写成脚本方式,支持一键安装和卸载。(有尝获取代码~)

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:原创!无插件hack方式实现conflulence open connect sso登陆 | Bruce's Blog

发表评论

留言无头像?