我尝试从mulesoft运行'简单'示例,但总是在以下BUILD FAILURE中结束
Failed to execute goal on project test: Could not resolve dependencies for project XXX: Failed to collect dependencies at com.mulesoft.security:mule-module-security-oauth2-provider:jar:1.3.2: Failed to read artifact descriptor for com.mulesoft.security:mule-module-security-oauth2-provider:jar:1.3.2: Failure to find com.mulesoft.security:mule-module-security:pom:1.3.2 in http://repo1.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of Central has elapsed or updates are forced -> [Help 1]
我的流程是
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:oauth2-provider="http://www.mulesoft.org/schema/mule/oauth2-provider"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/current/mule-spring-security.xsd
http://www.mulesoft.org/schema/mule/oauth2-provider http://www.mulesoft.org/schema/mule/oauth2-provider/current/mule-oauth2-provider.xsd">
<spring:beans>
<ss:authentication-manager id="resourceOwnerAuthenticationManager">
<ss:authentication-provider>
<ss:user-service id="resourceOwnerUserService">
<ss:user name="john" password="doe" authorities="RESOURCE_OWNER" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="resourceOwnerSecurityProvider" delegate-ref="resourceOwnerAuthenticationManager" />
</mule-ss:security-manager>
<oauth2-provider:config name="oauth2ProviderCode"
providerName="SampleAPI" port="8081" authorizationEndpointPath="sampleapi/api/authorize"
accessTokenEndpointPath="sampleapi/api/token"
resourceOwnerSecurityProvider-ref="resourceOwnerSecurityProvider"
scopes="READ_RESOURCE POST_RESOURCE" doc:name="OAuth provider module">
<oauth2-provider:clients>
<oauth2-provider:client clientId="myclientid"
secret="myclientsecret" type="CONFIDENTIAL" clientName="Mule Bookstore"
description="Mule-powered On-line Bookstore">
<oauth2-provider:redirect-uris>
<oauth2-provider:redirect-uri>http://localhost*</oauth2-provider:redirect-uri>
</oauth2-provider:redirect-uris>
<oauth2-provider:authorized-grant-types>
<oauth2-provider:authorized-grant-type>AUTHORIZATION_CODE</oauth2-provider:authorized-grant-type>
</oauth2-provider:authorized-grant-types>
<oauth2-provider:scopes>
<oauth2-provider:scope>READ_RESOURCE</oauth2-provider:scope>
<oauth2-provider:scope>POST_RESOURCE</oauth2-provider:scope>
</oauth2-provider:scopes>
</oauth2-provider:client>
</oauth2-provider:clients>
</oauth2-provider:config>
<http:listener-config name="HTTP_Listener_Configuration"
host="localhost" port="8081" doc:name="HTTP Listener Configuration" />
<flow name="protected-authcode">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/resources" doc:name="HTTP" />
<oauth2-provider:validate config-ref="oauth2ProviderCode"
doc:name="Validate Token" scopes="READ_RESOURCE" />
<set-payload
value="#[ ['name' : 'payroll', 'uri' : 'http://localhost:8081/resources/payroll'] ]"
doc:name="Set Payload" />
<json:object-to-json-transformer
doc:name="Object to JSON" />
</flow>
<!-- THIS FLOW IS JUST AN AID TO HELP MANUAL TESTING OF THE OAUTH2 DANCE -->
<flow name="redirectFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/redirect" doc:name="HTTP" />
<set-property value="302" propertyName="http.status"
doc:name="Property" />
<set-property propertyName="Location"
value="http://localhost:8081/sampleapi/api/token?grant_type=authorization_code&&client_id=myclientid&client_secret=myclientsecret&code=#[message.inboundProperties.code]
&redirect_uri=http://localhost:8081/redirect"
doc:name="Property" />
</flow>
</mule>
在我的POM文件中,我有以下回购:
...
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-oauth2-provider</artifactId>
<version>1.3.2</version>
</dependency>
...
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases2</id>
<name>MuleSoft Releases Repository2</name>
<url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
<layout>default</layout>
</repository>
</repositories>
此安全模块属于Anypoint Enterprise Security,我想要记住Mule有一个安全的企业级存储库。难道我必须联系Mule进行访问吗? 但另一方面,在他们的网站和给定的例子中没有关于这方面的信息。有人知道我可以尝试解决这个问题并成功运行这个例子吗?
答案 0 :(得分:0)
是的,有一个EE回购需要一个由Mulesoft提供的用户名/密码组合。如果您是客户,可以通过支持门户与他们联系。
<repository>
<id>mulesoft-ee-release</id>
<name>Mulesoft EE</name>
<url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
</repository>
然后在Maven settings.xml
中设置用户名/密码。