API 프록시가 백엔드 서비스에 사용자 인증 정보를 제공하도록 요구하여 라스트 마일 보안을 적용할 수 있습니다.
예를 들어 API 프록시가 백엔드 서비스에 API 키를 제공하려고 할 수 있습니다. 또한 API 프록시가 OAuth 클라이언트 사용자 인증 정보 액세스 토큰을 가져오고 제공할 수도 있습니다.
API 키
API 키는 API 프록시에서 백엔드 서비스로의 아웃바운드 요청에 적용할 수 있습니다. 여기서 백엔드 서비스는 API 키를 발급하고 검증할 수 있는 API라고 가정합니다.
아웃바운드 요청에 API 키를 제공하도록 API 프록시를 설정한 경우 런타임 시 API 프록시가 검색할 수 있는 위치에 API 키를 저장해야 합니다. API 키를 저장하는 데 사용할 수 있는 위치 하나는 키-값 맵입니다. 키-값 맵 작업 정책을 참조하세요.
AssignMessage 정책 유형을 사용하여 API 키를 아웃바운드 요청에 HTTP 헤더, 쿼리 매개변수 또는 페이로드 요소로 추가할 수 있습니다. 메시지 할당 정책을 참조하세요.
OAuth 클라이언트 사용자 인증 정보
OAuth 클라이언트 사용자 인증 정보를 사용하여 API 키에 취소 가능한 레이어를 추가합니다. 백엔드 서비스가 OAuth 클라이언트 사용자 인증 정보를 지원하는 경우 각 요청에 대해 클라이언트 사용자 인증 정보 액세스 토큰을 제공하도록 API 프록시를 구성할 수 있습니다.
토큰 엔드포인트에서 액세스 토큰을 가져오는 콜아웃을 실행하도록 API 프록시를 구성해야 합니다. 또한 각 호출에 대해 새로운 액세스 토큰을 얻지 못하도록 액세스 토큰을 캐시하는 데 API 프록시가 필요합니다.
아웃바운드 클라이언트 사용자 인증 정보를 구현하는 데 여러 가지 방법을 사용할 수 있습니다.
토큰 엔드포인트를 호출하여 액세스 토큰을 가져오도록 이 샘플을 수정할 수 있습니다. 이 샘플은 자바스크립트를 사용하여 아웃바운드 요청에 토큰을 HTTP Authorization 헤더로 연결합니다. 이 목적으로 Assign Message 정책을 사용할 수도 있습니다.
SAML
GenerateSAMLAssertion 정책 유형을 사용하면 SAML 어설션을 API 프록시에서 백엔드 서비스로 전송되는 아웃바운드 XML 요청 메시지에 연결할 수 있습니다. 이렇게 하면 백엔드 서비스가 API 프록시에서 수신한 요청에 대한 인증 및 승인을 수행할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[[["\u003cp\u003eLast-mile security is crucial for protecting backend services from direct attacks, preventing developers from bypassing API proxies to reach backend URLs.\u003c/p\u003e\n"],["\u003cp\u003eClient TLS/SSL, also known as mutual authentication, is the primary method for ensuring last-mile security between API proxies and backend services.\u003c/p\u003e\n"],["\u003cp\u003eOutbound authentication, such as using API keys or OAuth client credentials, can be implemented to secure backend services, with API keys stored in key/value maps.\u003c/p\u003e\n"],["\u003cp\u003eOAuth client credentials offer a revocable layer of security compared to API keys, and require the backend to be capable of issuing and validating access tokens.\u003c/p\u003e\n"],["\u003cp\u003eSAML assertions can also be used to secure outbound XML requests, allowing backend services to authenticate and authorize requests originating from API proxies.\u003c/p\u003e\n"]]],[],null,["# Last-mile security\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nLast-mile security protects the backend services that are proxied by API Services. The primary\ngoal of last-mile security is to prevent so-called \"end-run\" attacks, where an app developer\ndiscovers the URL for a backend service and bypasses any API proxies to directly hit the backend\nURL.\n\nFollowing are the primary options for setting up last-mile security:\n\n- Client TLS/SSL\n- Outbound authentication\n\nClient TLS/SSL\n--------------\n\nThe primary mechanism for securing the last-mile is client TLS/SSL, which is also known as\n'mutual authentication'.\n\nSee [Options for configuring TLS](/apigee/docs/api-platform/system-administration/options-configuring-tls).\n\nOutbound authentication\n-----------------------\n\nLast-mile security can also be enforced by requiring the API proxy to present a credential to\nthe backend service.\n\nFor example, you may wish to have an API proxy present an API key to your backend service. You\ncould also have an API proxy obtain and present a OAuth client credentials access token.\n\n### API key\n\nAPI keys can be applied to outbound requests from API proxies to backend services. This\nassumes that the backend service is an API that is capable of issuing and validating API\nkeys.\n\nIf you do set up an API proxy to present an API key on outbound requests, you must store the\nAPI key in a place where it can be retrieved by the API proxy at runtime. One location available\nfor storing API keys is a key/value map. See [Key Value Map Operations\npolicy](/apigee/docs/api-platform/reference/policies/key-value-map-operations-policy).\n\nYou can use the AssignMessage policy type to add the API key as an HTTP header, query\nparameter, or payload element to the outbound request. See [Assign Message policy](/apigee/docs/api-platform/reference/policies/assign-message-policy).\n| **Best practice:** To avoid exposing API keys over network, always configure server-side TLS/SSL on your backend services for outbound transactions that use API keys\n\n### OAuth client credentials\n\nOAuth client credentials can be used to add a layer of revocability to API keys. If your\nbackend services support OAuth client credentials, you can configure an API proxy to present a\nclient credentials access token for each request.\n\nThe API proxy must be configured to perform a callout to obtain the access token from your\ntoken endpoint. The API proxy is also required to cache the access token, to prevent it from\nobtaining a new access token for each call.\n| **Warning:** Your backend services must be capable of issuing and validating access tokens using the client credentials grant type for this to work.\n|\n| Always configure server-side TLS/SSL on your backend services for transactions that use\n| access tokens.\n\nA number of approaches can be used to implement outbound client credentials.\n| **Sample:** A working outbound OAuth sample that uses client credentials is implemented in the [Outbound\n| OAuth sample](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/outbound-oauth) on GitHub.\n\nYou can modify this sample to call your token endpoint to obtain an access token. This sample\nuses JavaScript to attach the token to the outbound request as an HTTP Authorization header. You\ncould also use [Assign\nMessage policy](/apigee/docs/api-platform/reference/policies/assign-message-policy) for this purpose.\n\n### SAML\n\nThe GenerateSAMLAssertion policy type can be used to attach a SAML assertion to an outbound\nXML request message, from the API proxy to a backend service. This enables the backend service to\nperform authentication and authorization on requests received from API proxies.\n\nSee [SAML Assertion\npolicies](/apigee/docs/api-platform/reference/policies/saml-assertion-policy)."]]