Sample use case
This sample uses these policies:
- Assign Message: Sets the encoded credentials into a response header.
This demo uses code from the third-party CryptoJS module to do base64 encoding on the user name and password presented in the request.
Set up, deploy, invoke
To deploy, run
$ sh deploy.sh
To test, run
$ sh invoke.sh
If you open
invoke.shtake a look at the cURL call:
curl -i "https://$org-$env.$api_domain/base64encoder?username=MyUserName&password=MyPassword"
An Assign Message policy echoes the encoded value back to the client as a custom HTTP header.
HTTP/1.1 200 OK User-Agent: curl/7.37.1 Host: docs-test.apigee.net Accept: */* X-Encoded-Credentials: Basic TXlVc2VyTmFtZTpNeVBhc3N3b3Jk Content-Length: 0 Connection: keep-alive
This screen shot from the Apigee Edge trace tool shows the placement of the policies used in this sample.
Policy used in this sample
Ask the community
Copyright © 2015 Apigee Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.