Mule 3.5를 Google API (작업, 캘린더 등)에 연결하려고하는데 OAuth2 인증과 관련하여 여러 가지 문제가 있습니다.Mule 3.5 - Google OAuth2 예
누구나 Google OAuth2 예제 (Google API 콘솔의 설정)를 사용하여 Mule 프로젝트의 예제 .xml 파일을 제공 할 수 있습니까?
링크도 마찬가지입니다.
Mule 3.5를 Google API (작업, 캘린더 등)에 연결하려고하는데 OAuth2 인증과 관련하여 여러 가지 문제가 있습니다.Mule 3.5 - Google OAuth2 예
누구나 Google OAuth2 예제 (Google API 콘솔의 설정)를 사용하여 Mule 프로젝트의 예제 .xml 파일을 제공 할 수 있습니까?
링크도 마찬가지입니다.
Google Connectors Suite for Mule에는 Mule XML configuration을 포함한 완전한 예가 있습니다.
게시 된 문서는 how to use OAuth connectors입니다. 그것이 도움이되는지 알려주십시오.
프로젝트 만들기 버튼을 사용하여 Google 개발자 계정 (https://console.developers.google.com/)에 애플리케이션을 만들어야합니다. Google 커넥터 구성에서 프로젝트 ID를 메모 해 두십시오.
그런 다음 애플리케이션을 클릭하고 API & Auth으로 이동해야합니다. 필요한 API가 'ON'상태로 설정되어 있는지 확인하십시오. 이 경우에는 캘린더를 켜고 싶지 않은 다른 것을 켜기를 원할 것입니다. 캘린더 서비스를 많이 사용하면 비용이나 할당량 한도가 발생할 수 있습니다.
Google 개발자 콘솔의 왼쪽에있는 인증 번호 & 인증 섹션에서 자격 증명을 선택해야합니다. 그런 다음 빨간색 버튼 을 클릭하고 새 클라이언트 ID을 만듭니다. 이렇게하면 정보의 두 가지 중요한 조각을 줄 것이다 :
설정해야 할 또 다른 중요한 사항은 리디렉션 URI입니다. 이 값은 다음과 같아야합니다.
http://localhost:8081/oauth2callback
이 값은 커넥터 구성에 입력 한 값과 일치해야합니다. 방화벽 뒤에서 Mule 서버를 실행중인 경우이 콜백이 서버에 도달 할 수 있도록 프록시와 같은 것을 구성해야합니다.
내가 일할 수 있었던 원시 예제입니다. 적절하게 clientID clientSecret 및 응용 프로그램 이름을 바꾸십시오. 예를 살펴보면
는<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:google-calendars="http://www.mulesoft.org/schema/mule/google-calendars"
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.4.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/google-calendars
http://www.mulesoft.org/schema/mule/google-calendars/1.0/mule-google-calendars.xsd
http://www.mulesoft.org/schema/mule/objectstore
http://www.mulesoft.org/schema/mule/objectstore/1.0/mule-objectstore.xsd
http://www.mulesoft.org/schema/mule/ee/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/https
http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.mulesoft.org/schema/mule/json
http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<!-- The 'consumerKey' is Client ID of you google application
The 'consumerSecret' is the Client Secret of the google application
The 'applicationName' is the application name you supplied (or Google created for you) when you created your application
on the google developer console
-->
<google-calendars:config-with-oauth
name="Google_Calendars"
consumerKey="replace-with-client-ID"
consumerSecret="replace-with-client-secret" doc:name="Google Calendars"
applicationName="replace-with-application-name">
<!-- The values here need to match the redirect URL you authorized for your Google Application
In this case the callback URL would be http://localhost:8081/ouath2callback
-->
<google-calendars:oauth-callback-config
domain="localhost" localPort="8081" path="oauth2callback" remotePort="8081" />
</google-calendars:config-with-oauth>
<!-- This is the objectstore that stores your Auth key which is used in the second flow -->
<objectstore:config name="ObjectStore" doc:name="ObjectStore" />
<!-- The first flow is executed when you go to http://localhost:8080/oauth-authorize
It initiates the Google authentication and if successful gets the auth key and puts it into the object store -->
<flow name="authorizationAndAuthenticationFlow" doc:name="authorizationAndAuthenticationFlow">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8080" path="oauth-authorize" doc:name="HTTP" />
<google-calendars:authorize config-ref="Google_Calendars"
doc:name="Google Calendars" />
<!-- Your Auth token is store in the key 'accessTokenId' -->
<objectstore:store config-ref="ObjectStore" key="accessTokenId"
value-ref="#[flowVars['OAuthAccessTokenId']]" overwrite="true"
doc:name="ObjectStore" />
</flow>
<!-- This flow can be called after the authentication is complete. It uses the previously stored token and to retreive your
Calendars and return them as JSON -->
<flow name="getInformationFromCalendar" doc:name="getInformationFromCalendar">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP" />
<!-- The enricher adds the access token to your message -->
<enricher target="#[flowVars['accessTokenId']]" doc:name="Message Enricher">
<objectstore:retrieve config-ref="ObjectStore"
key="accessTokenId" defaultValue-ref="#['']" doc:name="Get AccessToken" />
</enricher>
<expression-filter expression="#[flowVars['accessTokenId'] != '']"
doc:name="Is Access Token Set" />
<!-- gets your first 200 calendars using the accessToken that you enriched the message with-->
<google-calendars:get-calendar-list
config-ref="Google_Calendars" maxResults="200"
pageToken="#[flowVars['GoogleCalendar_NEXT_PAGE_TOKEN']]" doc:name="Google Calendars"
accessTokenId="#[flowVars['accessTokenId']]" />
<json:object-to-json-transformer
doc:name="Object to JSON" />
</flow>
</mule>
, 나는 공개 키 지문으로 사용되는, 아직 내가 OAuth는 서비스 계정을 설정 한 경우, 예를 들어, ... 소비자 키 및 소비자 비밀에 사용하는 것에 대한 혼란 스러워요 Mule Google 커넥터 구성의 'Consumer Key' 소비자 비밀로 무엇을 사용할 수 있습니까? 공개 키 지문과 관련된 .p12 파일은 무엇입니까? 그렇다면 입력 방법은 무엇입니까? – GarySharpe