CLI를 사용한 OAuth 및 사용자 정의 인증

OAuth는 모든 외부 서비스에서 사용자의 계정 정보를 사용할 수 있고 비밀번호를 공개하지 않아도 안전하게 접근할 수 있는 영패 기반 인증 방법이다.예를 들어 많은 사이트들이 다양한 로그인 방식을 지원한다.흔히 볼 수 있는 로그인 방법 중 하나는 Gmail이나 페이스북을 통해 로그인하는 것이다.이것은 OAuth의 한 예다.다음은 OAuth 인증의 기본 구조를 보여 준다.
webMethods.io Integration의 CLI 프레임워크는 많은 서비스에 내장된 OAuth 인증 모듈을 제공합니다.이러한 내장 모듈을 사용하거나 필요에 따라 사용자 정의 OAuth 인증 모듈을 만들 수 있습니다.
두 가지 방법으로 OAuth 인증을 만들 수 있습니다.
  • 내장형 OAuth 인증 모듈 사용 webMethods.io
  • 맞춤형 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

    좋은 웹페이지 즐겨찾기