我有一个Ext Date类的问题,似乎为解析日期返回错误的时区.使用下面的代码我创建一个日期对象为1966年5月24日15:46 BST:
date = "1966-05-24T15:46:01+0100";
var pDate = Date.parseDate(date, "Y-m-d\\TH:i:sO", false);
Run Code Online (Sandbox Code Playgroud)
然后我称之为:
console.log(pDate.getGMTOffset());
Run Code Online (Sandbox Code Playgroud)
我希望得到与orignal日期相关的偏移量(GMT + 1),但我得到的是浏览器的本地时区.如果浏览器设置为远远超过GMT的时区,则日期的日期部分也将被翻转(因此日期现在将显示为1966年5月25日).
有谁知道如何绕过这个并让Ext识别解析日期的正确时区而不是本地浏览器时区?
如果这是不可能的,可以强制Ext使用GMT而不是试图解释时区吗?
我试图在Spring OAuth应用程序中使用刷新令牌但没有成功.系统将在密码授予上发出刷新令牌:
{
"access_token": "xxxxx",
"token_type": "bearer",
"refresh_token": "xxxxxx",
"expires_in": 21599,
"scope": "read write"
}
Run Code Online (Sandbox Code Playgroud)
但尝试使用刷新令牌会导致以下错误:
curl -u acme -d"grant_type = refresh_token&refresh_token = xxxxxx" http:// localhost:9999/uaa/oauth/token
{
"error": "invalid_token",
"error_description": "Cannot convert access token to JSON"
}
Run Code Online (Sandbox Code Playgroud)
我的auth服务器配置如下:
@Controller
@SessionAttributes("authorizationRequest")
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
@EnableResourceServer
@ImportResource("classpath:/spring/application-context.xml")
@Configuration
public class ApplicationConfiguration extends WebMvcConfigurerAdapter {
@RequestMapping("/user")
@ResponseBody
public Principal user(Principal user) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
System.out.println(auth.toString());
return user;
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
registry.addViewController("/oauth/confirm_access").setViewName("authorize");
}
@Configuration …Run Code Online (Sandbox Code Playgroud)