1. Application 관련 서비스 정리 ( WmAPIGateway.apigateway.v105.applications 에 있는 서비스 매핑 )
1) apigateway.v105.applications flowservice 정리
=> ElasticSearch의 gateway_default_applications 와 매핑되는 서비스
=> Gateway Applications CreateApplication
=> _post 서비스를 통해서 gateway_default_applications 인덱스에 application을 생성할 수 있음
=> 필수 값 name 만 넣고 application 생성 가능
=> pipeline Out 값의 id 를 registerApplication 에 input 값으로 사용 가능
_post (createApplication)서비스 Service In - Service Out - Pipeline Out

apigateway.v105.applications:_delete -> deleteApplication
apigateway.v105.applications:_patch -> patchApplication
apigateway.v105.applications:_get -> getApplication
apigateway.v105.applications:_post -> createApplication
apigateway.v105.applications:_put -> updateApplication
2) apigateway.v105.applications.apis flowservice 정리
=> Elasticsearch의 gateway_default_registeredapplications 인덱스와 매핑 되는 서비스
=> 해당 gateway_default_registeredapplications 인덱스가 무슨 기능을 하고 있는지는 확실히는 알아내지 못함
=> apiIds를 비워 놓고 테스트를 진행하여 해당 apiIds가 들어가면 application 생성시 api가 등록될 것으로 예상
< - getAPIs 를 통해 api id를 받고싶은데 service out 에 API id를 받아 낼 수 있는지...
query문을 이용해서 해당 id를 search는 가능한데 그 id를 받을 수 있는지 테스트해야함
ex) /(인덱스명)/_search
body에 입력값 (Json) 입력
해당 id 를 갖는 인덱스의 doc를 세부 search 가능 but service out 으로 값을 받아오는법을...
{"query": {"match": { "_id": "0567bc79-fe7d-4b0a-abde-75a0be64d8ef" }}}
_post 서비스를 통해 해당 인덱스에 document 하나를 생성할 수 있다.
service in : applicationId <- applicationid 값을 넣어준다. , apiIds <- application 등록시 해당되는 api를 저장함
{ "query":{
"query_string":{
"default_field" : "correlationid",
"query" : "\"APIGW:29a54df0-c994-4232-b933-355d576eb8e0:656\""
}
}
}
\" 를 양쪽 넣어서 이 안의 내용이 자체가 string이라고 지정해주는것입니다
결론
A:B:C 로 검색하면 A or B or C로 검색한다
"\A:B:C"\로 검색해야 A:B:C를 자체로 검색한다
테스트 match 의 경우 : 를 넣으면 무조건 형태소 분석 ( A or B or C)로 검색하고
query_string의 경우 형태소 분석 무조건 안되는 것으로 보입니다.

방식으로 elasticsearch 에 직접 _search 해도 되고 인덱스 명을 지정해도 되는데 서비스에 직접.. 불가능.. 왜..?

=> 쿼리문이 필요 없음 id 로 가능



APIs를 매핑 하기 위해 apigateway.apis:getAPI Application:test 로 개별 호출 가능하지만

서비스를 이어붙이면.. input값에다가 똑같이 넣어줘도 오류가 발생함 이유를 알 수 없음.
apigateway.v105.applications.apis:_post -> registerApplication
apigateway.v105.applications.apis:_get -> getRegisteredApplications
apigateway.v105.applications.apis:_delete -> unregisterApplication
apigateway.v105.applications.apis:_put -> 비어있음.
3) apigateway.v105.applications.identifiers flowservice 정리
=> 매핑 되는 단독 index는 찾지 못함, applications 에 Service in 에 사용하여 gateway_default_applications 인덱스에 매핑 되는 것으로 생각 됨
=> Error : Identifier 'key' attribute not present, should be one of [httpBasicAuth, accessProfile, apiKey, wssecX509Token, wssecUsernameToken, ipAddressRange, hostNameAddress, openIdClaims, jwtClaims, oAuth2Token, payloadElement, httpsCertificate, XPathExpression, kerberosToken, token, partnerId, httpHeaders]
=> 오류로 key값에 해당 값을 넣어도 생성이 안됨
apigateway.v105.applications.identifiers:_post -> createIdentifier
service in (name / key / value(stringList))
4) apigateway.v105.strategies flowservice 정리
=> gateway_default_strategies 인덱스와 gateway_default_oauth2clientregistration 에 매핑되는 서비스
=> 해당 service in 에 id, type, authServerAlias, name, description 까지 입력값으로 넣을 수 있음,
=> dcrConfig document 형식으로 입력 시 입력됨

값으로 테스트 시에 strategies 와 oauth2clientregistration 인덱스에 insert



gateway_default_oauth2clientregistration에 입력되는 것을 확인

Authentication에는 등록이 안되어있음..
_post 를 제외한 서비스들 service in값을 알 수 없음, _post 서비스의 service in 값도 강제로 입력한 값들
apigateway.v105.strategies:_delete -> deleteStrategy
apigateway.v105.strategies:_get -> getStrategy
apigateway.v105.strategies:_post -> createStrategy
apigateway.v105.strategies:_put -> updateStrategy
java 디컴파일러로 열어지지 않음... 다른 class 파일은 가능

=====>> 해당 gateway 내부에서 작업들을 wireshark로 분석해서 service in 값을 찾아야 할 듯
2. OAuth2.0 관련 서비스 정리
OAuth 전체 flow Wireshark 분석 (Postman <--> Gateway)

1) GET / invoke/pub.gateway.oauth2/authorize? 캡쳐
필수 파라미터 값


Gateway의 Approve Page를 response로 받음
2) POST /invoke/secure.apigateway.oauth2/approve - Request 캡쳐

Header에 base auth : Administrator/manage

Body에 입력되는 값들

-> Response 캡쳐
approve 시에 Location: .....code값과 redirect_uri 가 대체 URI 형태 %253A %252F %252F .... response 된다.
(Location: https://oauth.pstmn.io/v1/callback?
code=2a6c9b880cf44ed38187bd750fb082ff
&grant_type=authorization_code
&redirect_uri=https%253A%252F%252Foauth.pstmn.io%252Fv1%252Fcallback
&scope=bank.list\r\n)
3) POST /invoke/pub.apigateway.oauth2/getAccessToken 캡쳐


response 로 access_token / token_type/ expires_in/ scope를 받음
Oauth 인증 규격으로 authroize 구현

=> pub.apigateway.oauth2:authrize 와 secure.apigateway.oauth2:approve service_in , out값이 비어있어 분석 필요..
=> getAccessToken서비스에서 approve 에서 response값으로 받는 code 값이 필요한데 값을 찾지 못함
respose 화면 parameter 값과 authorization 값 입력 후 request




이외 관련 ElasticSearch OAuth 인증 관련 index
getAccessToken을 이용하여 생성된 accessToken은 gateway_default_oauth2materializedtoken 인덱스에 저장

gateway_default_oauth2scopes

Administrator > Security > JWT/Oauth/OpenID > OAuth scopes 에 생성되는 정보들이 저장되는 인덱스
gateway_default_oauthscopedata

API 생성시 기본으로 생성되는 API scope와 APIs > Scope 에서 생성한 Scope들이 저장되는 인덱스
(id 값이 어떤 값과 매핑되는지 확인할 필요)
gateway_default_gatewayscopes



해당 서비스 분석 필요..
JWT 관련 정리

portal에서 application 생성 시에 gateway_default_applications 인덱스 내부 document -> identifiers에 추가되는 정보
key값을 jwtClaims로 추가하여 어플리케이션 생성시 jwt 토큰 값을 identifiers 에 저장할 수 있지 않을까 추측

포털로 생성한 jwt 상세값
Administrator / manage 계정 이용
portal로 요청해서 생성한 application 정보



+)
=> APIs <-> Application (gateway_default_applications)
Strategy(gateway_default_strategies) <-> Application(gateway_default_applications)
서로 생성하는 서비스로 생성 후 각각 id값을 업데이트 apiIDs값을 업데이트 하면 생성되지 않을지 => id가 같은 값이 없는데..?