CLI를 사용한 OAuth 및 사용자 정의 인증
webMethods.io Integration의 CLI 프레임워크는 많은 서비스에 내장된 OAuth 인증 모듈을 제공합니다.이러한 내장 모듈을 사용하거나 필요에 따라 사용자 정의 OAuth 인증 모듈을 만들 수 있습니다.
두 가지 방법으로 OAuth 인증을 만들 수 있습니다.
webMethods.io 내장형 OAuth 인증 모듈 사용
webMethods.io 내장형 OAuth 인증 모듈 사용
첫 번째 단계:커넥터 생성기에서 "wmio auth"명령을 실행하고 선택하십시오oauth>내장되어 있습니다.선택권.내부 OAuth 인증 모듈을 제공하는 서비스 목록webMethods.io을 보실 수 있습니다.
2단계: OAuth 인증을 작성할 서비스를 선택합니다.
이것은 '신분 검증' 을 만들 것입니다.응용 프로그램 디렉터리에 있는 js 파일입니다. 인증 논리를 추가할 수 있습니다.다음은 기본적인 OAuth 인증 구조입니다.
OAuth 인증 구조
module.exports = {
label : 'Connect to Gmail,
mock_input:
{
access_token: 'token'
},
oauth: 'gmail',
input: {},
validate : function (input, output)
{
// auth data will be available in input.auth
// var accessToken = input.auth.access_token;
}
}
우리는 하나의 예를 통해 이 구조를 한층 더 이해합시다.예.
WebMethods에서 제공하는 내장된 OAuth 인증 모듈의 예시를 보십시오.io, Software AG Tech Community의 원본 게시물을 참조하십시오.
2. 사용자 정의 OAuth 인증 모듈 만들기
webMethods.io 외부 서비스에 대한 사용자 정의 OAuth 인증 모듈을 만들 수 있습니다.이렇게 하려면 다음 절차를 따르십시오.
1단계: 연결기 생성기에서 wmio auth 명령을 실행하고'oauth>create new'옵션을 선택하십시오
2단계: OAuth 1과 OAuth 2라는 두 가지 옵션을 볼 수 있습니다.인증을 작성할 OAuth 유형을 선택합니다.
3단계: 사용자 정의 OAuth 인증 모듈의 이름을 제공합니다.
이 상세한 정보를 제공하면 'oauth' 라는 파일이 나타납니다.json'은 프로그램 디렉터리에 생성됩니다.그리고 이 파일에 존재하는 키의 관련 값을 채울 수 있습니다.
참고: 인증을 수정할 필요는 없습니다.OAuth 인증을 사용자 정의하는 js 파일입니다.
OAuth1 인증 모듈의 구조는 다음과 같습니다.
{
"type": "oauth1",
"title": "{{title}}",
"consumerKey": "<CONSUMER KEY>",
"consumerSecret": "<CONSUMER SECRET>",
"signatureMethod": "HMAC-SHA1",
"requestURL": "<REQUEST URL>",
"authURL": "<AUTH URL>",
"accessURL": "<ACCESS TOKEN URL>",
"requiredFields": [],
"authQueryParams": { },
"validate": {
"url": "ANY API URL TO VALIDATE TOKEN OF THIRD PARTY SERVICE",
"headers": {
//<optional>
},
"query": {
//<optional>
"oauth_token": "{oauth_token}",
"oauth_token_secret": "{oauth_token_secret}"
}
},
"redirectURL": "{{redirectURL}}"
}
Software AG Tech Community의 원시 문장의 다른 두 가지 예시를 빌려 이 구조에 대한 정보를 더 많이 알 수 있다.사용자 지정 OAuth 배포
사용자 정의 OAuth를 만든 후에는 트리거와 작업에서 사용하기 위해 Connector Builder에 배포해야 합니다.
사용자 정의 OAuth를 배치하려면 커넥터 생성기에서 "flow OAuth deploy"명령을 실행합니다.
이것은 모든 Github 작업과 트리거의 "권한 부여"필드에 사용자 정의 OAuth를 추가합니다.
{
"type": "oauth2",
"title": "github",
"clientId": "81vqd1s4y***",
"clientSecret": "cqL4JnnxHpcE**",
"authURL": "https://github.com/login/oauth/authorization",
"tokenURL": "https://github.com/login/oauth/access_token",
"preAuthProcessing": {
"Authorization": "Basic base64({client_id}{client_secret})"
},
"authQueryParams": {
"client_id": "{client_id}",
"client_secret": "{client_secret}"
},
"preTokenProcessing": {
"headers": {
"Authorization": "Basic base64({client_id}{client_secret})"
}
},
"tokenParams": {
"method": "",
"headers": {},
"data": {
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"redirect_uri": "{redirect_uri}",
"grant_type": "authorization_code"
}
},
"preRefreshProcessing": {
"Authorization": "Basic base64({client_id}{client_secret})"
},
"refreshParams": {
"data": {
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"redirect_uri": "{redirect_uri}",
"grant_type": "refresh_token",
"refresh_token": "{refresh_token}"
}
},
"requiredParams": [
{
"id": "domain",
"title": "Domain",
"description": "domain"
}
],
"includeParams": {
"domain_url": "https://{domain}.example.com",
"domain": "{domain}"
},
"refreshURL": "https://github.com/login/oauth/access_oken",
"scope": {
"public_repo": "Read/write access to public repos and organizations.",
"gist": "Write access to gists."
},
"validate": {
"url": "https://api.github.com/users/octocat/orgs",
"headers": {
"Authorization": "Bearer {access_token}"
},
"query": {}
},
"redirectURL": "https://auth-int.webmethods.io/auth/oauth/github_eb2804f6a2/fla8f8919884231f3a77973d/return"
}
OAuth 사용자 정의CLI 커넥터에서 사용자 정의 인증을 사용하려면 OAuth 2를 만든 다음 인증에 다음 키를 추가해야 합니다.js 파일
기본값: 참
'풍속습관'진짜예요?
사용자화 oauth 모드: {}
Is default: 기본 라이센스를 비활성화하려면 false로 설정합니다.
is custom: 사용자 정의 라이센스를 비활성화하려면 false로 설정합니다.
사용자 정의 oauth 모드: 사용하는 oauth 형식
사용자 지정 OAuth 업데이트
모든 서비스의 사용자 정의 OAuth를 변경하려면 "OAuth"의 자세한 정보를 업데이트해야 합니다.json 파일이며 커넥터 생성기의 "flow OAuth deploy"명령을 사용하여 재배치합니다.
Read full topic
Reference
이 문제에 관하여(CLI를 사용한 OAuth 및 사용자 정의 인증), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/techcommunity/oauth-and-custom-auth-using-cli-ke1텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)