Nexus3 集成 crowd 插件

公司使用的軟件開發和協做工具爲 Atlassian 系列軟件,因此統一使用 crowd 來實現統一登陸(SSO)。html

crowd 配置

具體操做細節見我以前寫的 Atlassian 系列軟件安裝(Crowd+JIRA+Confluence+Bitbucket+Bamboo)java

添加 nexus 用戶組

此處的 nx-admin 組爲 nexus 默認的管理組。git

添加 nexus 應用

注意:「groups」 和 「Remote addresses」 的設置。github

安裝 nexus3-crowd-plugin 插件

Available in Nexus Repository Manager Pro onlyapache

官方 Nexus Pro 直接集成了 Atlassian Crowd 支持,但社區版不支持,須要本身集成開源插件。api

插件地址:https://github.com/pingunaut/nexus3-crowd-pluginbash

插件安裝問題

在插件部署過程當中,我遇見以下問題:app

2020-04-05 16:33:00,792+0800 ERROR [FelixDispatchQueue]  *SYSTEM nexus3-crowd-plugin - FrameworkEvent ERROR - nexus3-crowd-plugin
org.osgi.framework.BundleException: Unable to resolve nexus3-crowd-plugin [49](R 49.0): missing requirement [nexus3-crowd-plugin [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=org.sonatype.nexus.security.authz)(version>=3.20.0)) Unresolved requirements: [[nexus3-crowd-plugin [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=org.sonatype.nexus.security.authz)(version>=3.20.0))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4132)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
	at java.lang.Thread.run(Thread.java:748)

解決方法socket

# 下載插件代碼到本地
$ git clone https://github.com/pingunaut/nexus3-crowd-plugin.git

# 修改 pom.xml 內容
$ vi pom.xml
......
<parent>
    <groupId>org.sonatype.nexus.plugins</groupId>
    <artifactId>nexus-plugins</artifactId>
    <!-- 修改 parent 的版本與 nexus3 的版本一致 -->
    <version>3.12.1-01</version>
</parent>
......
<dependency>
    <groupId>org.sonatype.nexus</groupId>
    <artifactId>nexus-plugin-api</artifactId>
    <!-- 註釋掉下面這行,把依賴包打入到插件 jar 中 -->
    <!--<scope>provided</scope>-->
</dependency>
......

# 從新編譯打包
$ mvn clean package

前提條件

  • JDK 8 is installed
  • Sonatype Nexus OSS 3.x is installed

下載 nexus3-crowd-plugin 插件

$ cd /home/nexus/nexus3/nexus-3.12.1-01/system
$ wget https://github.com/pingunaut/nexus3-crowd-plugin/releases/download/nexus3-crowd-plugin-3.4.2/nexus3-crowd-plugin-3.4.2.jar

將綁定添加到 startup.properties

$ echo "reference\:file\:nexus3-crowd-plugin-3.4.2.jar = 200" >> /home/nexus/nexus3/nexus-3.12.1-01/etc/karaf/startup.properties

配置 crowd.properties

$ echo "# 配置 crowd 的地址
crowd.server.url=http://localhost:8095/crowd/
# 配置 crowd 裏該 Application 的名稱
application.name=nexus
# 配置 crowd 裏該 Application 的密碼
application.password=nexus
cache.authentication=false

# optional:
timeout.connect=15000
timeout.socket=15000
timeout.connectionrequest=15000" > /home/nexus/nexus3/nexus-3.12.1-01/etc/crowd.properties

# 重啓驗證
$ sh /home/nexus/nexus3/nexus-3.12.1-01/bin/nexus restart

nexus 設置

激活插件

使用 crowd 用戶登陸

查看 crowd 的用戶信息。
ide

查看 crowd 的用戶詳細:

相關文章
相關標籤/搜索