我收到错误"此策略包含以下错误:策略必须包含有效的版本字符串有关IAM策略语法的更多信息",当我尝试在AWS中创建新策略时,甚至我在策略中包含了该版本.我的政策是
{
"Version": "2015-06-19",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::repo.com",
"arn:aws:s3:::repo.com/*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud) 我有一个休息api,我在使用spring security Basic Authorization进行身份验证,其中客户端为每个请求发送用户名和密码.现在,我想实现基于令牌的身份验证,我将在用户首先进行身份验证时在响应头中发送令牌.对于进一步的请求,客户端可以在标头中包含该标记,该标记将用于向用户验证资源.我有两个身份验证提供程序tokenAuthenticationProvider和daoAuthenticationProvider
@Component
public class TokenAuthenticationProvider implements AuthenticationProvider {
@Autowired
private TokenAuthentcationService service;
@Override
public Authentication authenticate(final Authentication authentication) throws AuthenticationException {
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
final HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
final String token = request.getHeader(Constants.AUTH_HEADER_NAME);
final Token tokenObj = this.service.getToken(token);
final AuthenticationToken authToken = new AuthenticationToken(tokenObj);
return authToken;
}
@Override
public boolean supports(final Class<?> authentication) {
return AuthenticationToken.class.isAssignableFrom(authentication);
}
}
Run Code Online (Sandbox Code Playgroud)
在daoAuthenticationProvider中,我设置自定义userDetailsService并通过从数据库中获取用户登录详细信息进行身份验证(只要使用授权传递用户名和密码,该工作正常:基本bGllQXBpVXNlcjogN21wXidMQjRdTURtR04pag ==作为标头)
但是当我使用X-AUTH-TOKEN(即Constants.AUTH_HEADER_NAME)在标头中包含token时,不会调用tokenAuthenticationProvider.我收到错误了
{"timestamp":1487626368308,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource","path":"/find"}
Run Code Online (Sandbox Code Playgroud)
以下是我添加身份验证提供程序的方法.
@Override
public void …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Windows 64位中安装Oracle 11G R2.但得到以下错误
Oracle Installer:[INS-13001] Environment does not meet minimum requirements
Run Code Online (Sandbox Code Playgroud)
解决办法是什么?
对于我正在处理的要求,请参阅测试用例中的 de-ignore Json 字段。
作为在测试用例中忽略 Json 字段的解决方案,我使用 if else 条件动态切换 json 视图,如下所示。
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
@Component
public class JacksonMapperUtil {
@Autowired
private MappingJackson2HttpMessageConverter jsonConverter;
public void modifyView(final Boolean internalView) {
if (internalView) {
this.jsonConverter.getObjectMapper().setConfig (
this.jsonConverter.getObjectMapper().getSerializationConfig().withView(View.Internal.class));
}
else {
this.jsonConverter.getObjectMapper().setConfig (
this.jsonConverter.getObjectMapper().getSerializationConfig().withView(View.Public.class));
}
}
}
Run Code Online (Sandbox Code Playgroud)
但理论上,当同时有多个请求,其中一个请求需要使用公共视图而其他内部视图需要使用时,这应该不起作用,因为我们正在更新同一对象中的视图。因此,我正在寻找一种解决方案,可以为每个请求动态切换视图。请指出我正确的方向。
我正试图从我的Phonegap开发者应用程序运行手机间隙应用程序.但是收到错误"无法从服务器下载存档".我正在连接到电话间隙桌面应用程序中显示的IP地址.