我正在使用;
- 日蚀朱诺
- ADT-22.3.0
- aws-android-sdk-1.7.0
对于使用AWS代币自动售货机代码,我使用了下面链接中的android示例代码;http://aws.amazon.com/code/4598681430241367
我的身份TVM模块部署在Glassfish服务器4.0 上
当尝试与Identity TVM样本通信时,我的AmazonS3PersonalFileStore android样本;其给出错误
11-24 15:16:54.886: W/AmazonTVMClient(2262): Request to Token Vending Machine failed with Code: [404] Message: [Unable to reach resource at [http://ip.ip.ip.ip:8080/tvm/login?uid=59434cd89b7ff4b72695fbe55dc06e10&username=useruser×tamp=2013-11-24T15%3A16%3A54.149Z&signature=fca134941ac0f1432568b1590057a64c1a537934d0f7c94b380c9fb23758bbd8]]
服务器端出现错误;
[2013-11-24T15:17:00.095+0000] [glassfish 4.0] [WARNING] [] [TokenVendingMachineLogger] [tid: _ThreadID=19 _ThreadName=http-listener-1(2)] [timeMillis: 1385306220095] [levelValue: 900] [[
Client signature : fca134941ac0f1432568b1590057a64c1a537934d0f7c94b380c9fb23758bbd8 doesnot match with server generated signature .Setting Http status code 401]]
[2013-11-24T15:17:00.097+0000] [glassfish 4.0] [SEVERE] [] [TokenVendingMachineLogger] [tid: _ThreadID=19 _ThreadName=http-listener-1(2)] [timeMillis: 1385306220097] [levelValue: 1000] [[Error validating login request for username : useruser]]`
如果有人能帮忙打分解决问题;我也希望没有什么特别的需要做的,以适应身份TVM代码运行在玻璃鱼?
编辑
当我在ElasticBeanstalk上部署IdentityTVM.war(随下载而来的开箱即用)时,它运行得很好。我认为问题出在我修改代码以处理玻璃鱼的方式上。我正在对TVM代码进行以下更改;
- com.amazonaws.tvm.Configuration:用我的TVMUser(在IAM中创建)凭据硬编码三个项目(AWS_ACCESS_KEY_ID、AWS_SECRET_KEY、APP_NAME)
TokenVendingMachinePolicy.json:更改了我的策略如下;
{"Statement": [ {"Effect":"Allow","Action":["s3:PutObject","s3:GetObject","s3:DeleteObject"],"Resource":"arn:aws:s3:::MyBUCKET/__USERNAME__/*"}, {"Effect":"Allow","Action":"s3:ListBucket","Resource":"arn:aws:s3:::MyBUCKET","Condition":{"StringLike":{"s3:prefix":"__USERNAME__/"}}}, {"Effect":"Deny","Action":["iam:*", "sts:*", "sdb:*"],"Resource":"*"}]}
我是否按照正确的步骤修改IdentityTVM以部署玻璃鱼?我不得不使用glassfish,因为我们的架构有一个基于它的集群环境。
我认为这将是一个端点不匹配的问题,即:
客户端:
AwsCredential.properties
tokenVendingMachineURL=tvm.mydomain.com
TVM
得出的终点
HttpServletRequest.getServerName()
我也遇到了同样的401问题,这就是原因。请参阅我在亚马逊移动论坛上的帖子:https://forums.aws.amazon.com/thread.jspa?threadID=143949
TVM使用localhost作为端点。我需要更新我的vhosts文件以使项目包含ProxyPreserveHost On
希望这能有所帮助。