2014-04-21 2 views
0

응용 프로그램을 spring-security-oauth-2.0.0-M2로 빌드 했으므로 2.0.0.RC1로 업그레이드하려고합니다. 샘플 구성이 크게 변경되어 Java 구성을 사용합니다.

구성을 java config로 변환했지만이 오류가 발생했습니다. 사월 21

2014 오후 5시 32분 43초 org.apache.catalina.core.ApplicationContext 로그 INFO : 32 : 44.703 [로컬 호스트 startStop-1]의 ERROR osweb 스프링 루트 초기화 17의 WebApplicationContext. context.ContextLoader - 컨텍스트 초기화에 실패하여 java.lang.NullPointerException : org.springframework.security.oauth2.config.annotat ion.web.configuration.AuthorizationServerEndpoints 구성 $ TokenStoreRegistrar.postProcessBeanF actory에서 널 (AuthorizationServerEndpointsConfiguration.j의 AVA : 179) ~ [spring-security-oauth2-2.0.0.RC1.jar : na] at org. springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors (ABSTR actApplicationContext.java:694) ~ [스프링 상황 3.2.8.RELEASE.jar : 3.2.8.RELEASE] org.springframework.context.support에서 .AbstractApplic ationContext.invokeBeanFactoryPostProcessors (ABSTR actApplicationContext.java:684) ~ [스프링 상황 3.2.8.RELEASE.jar : 3.2.8.RELEASE] org.springframework.context.support.AbstractApplic ationContext에서. 새로 고침 (AbstractApplicationContext.ja va : 461) 에서 [spring-context-3.2.8.RELEASE.jar : 3.2.8.RELEASE] org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationCon 텍스트 (ContextLoader. java : 410) ~ [spring-web-3.2.8.RELEASE.jar : 3.2.8.RELEASE]에서 org.springframework.web.context.ContextLoader.init WebApplicationContext (ContextLoader.java:306) ~ [스프링 웹 3.2.8.RELEASE.jar : 3.2.8.RELEASE] org.springframework.web.context.ContextLoaderListe에서 ner.contextInitialized (ContextLoaderListener.java : 112) [스프링 웹 - 3.2.8.RELEASE.jar : 3.2.8.RELEASE] org.apache.catalina.core.StandardContext.listenerS tart (StandardContext.java:4937) [tomcat-embed-core-7.0.47.jar : 7.0 .47] at org.apache.catalina.core.StandardContext.startInte rnal (StandardContext.java:5434) [tomcat-embed-core-7.0.47.jar : 7.0.47] at org.apache.catalina.util.LifecycleBase.start (Lifec ycleBase.java:150) [tomcat-embed-core-7.0.47.jar : 7.0.47] at org.apache.catalina.core.ContainerBase $ StartChild. 에서 [Tomcat-embed-core-7.0.47.jar : 7.0.47] (ContainerBase.java:1559)를 호출하십시오. org.apache.catalina.core.ContainerBase $ StartChild. 에서 [ContainerBase.java:1549] [tomcat-embed-core-7.0.47.jar : 7.0.47] 호출 (FutureTask.jav a : 262) [미래 : 작업] .0_45] at java.util.concurrent.ThreadPoolExecutor.runWorker ( ThreadPoolExecutor.java:1145) [없음 : 1.7.0_45] at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:615) [없음 : na : 1.7.0_45] at java.lang.Thread.run (Thread.java:744) [없음 : 1.7.0_45]는

내 구성은 sprklr 설정을

@Configuration 
@EnableAuthorizationServer 
protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter { 
    @Autowired 
    private TokenStore tokenStore; 
    @Autowired 
    private UserApprovalHandler userApprovalHandler; 
    @Autowired 
    @Qualifier("authenticationManagerBean") 
    private AuthenticationManager authenticationManager; 

    @Bean 
    public TokenStore tokenStore() { 
     return new InMemoryTokenStore(); 
    } 

    @Override 
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception { 

     clients.inMemory().withClient("some-client") 
       .authorizedGrantTypes("authorization_code", "password", "client_credentials") 
       .authorities("ROLE_USER", "ROLE_CLIENT") 
       .scopes("play", "trust") 
       .secret("xyz") 
       .accessTokenValiditySeconds(6000) 
       .and() 
       .withClient("some-other-client") 
       .authorizedGrantTypes("implicit") 
       .authorities("ROLE_USER", "ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") 
       .scopes("play", "trust") 
       .autoApprove(true) 
       .accessTokenValiditySeconds(6000); 
    } 

    @Override 
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { 
     if (tokenStore == null) { 
      throw new IllegalStateException("Token store is null"); 
     } 
     if (userApprovalHandler == null) { 
      thrownew IllegalStateException ("User approval handler is null"); 
     } if (authenticationManager == null) { 
      throw new IllegalStateException("Auth manager is null"); 
     } 
     endpoints 
       .userApprovalHandler(userApprovalHandler) 
       .authenticationManager(authenticationManager) 
       .tokenStore(tokenStore); 
    } 

    @Override 
    public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception { 
     oauthServer.realm("myapp/client"); 
    } 

} 

당신은 내가 구성에 널 (null)을 검사하고 있습니다 볼 수 있듯이 (AuthorizationServerEndpointsConfigurer 엔드 포인트) 방법을 샘플로 대부분 유사하며, 모두가 잘 보이지만 어떻게 든 레지스트리 AuthorizationServerEndpointsConfiguration $ TokenReg istrar가 설정되지 않습니다.

는 마지막 스냅 샷 버전을 사용하여 작동하기 때문에

@Configuration 
protected static class TokenStoreRegistrar implements BeanDefinitionRegistryPostProcessor { 

    private BeanDefinitionRegistry registry; 

    // Use a BeanFactoryPostProcessor to register a bean definition for a TokenStore in a safe way (without 
    // pre-empting a bean specified by the user) 
    @Override 
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { 
     if (!registry.containsBeanDefinition(TOKEN_STORE_BEAN_NAME)) { 
      registry.registerBeanDefinition(TOKEN_STORE_BEAN_NAME, new RootBeanDefinition(InMemoryTokenStore.class)); 
     } 
    } 

    @Override 
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { 
     this.registry = registry; 
    } 

} 

답변

1

그것은 그 다음에 릴리스에서 수정 될 예정입니다 보인다 (봄 보안 OAuth를 코드에서 촬영) (2.0.0.BUILD-SNAPSHOT < 2014년 4월 19일 >).

+0

아, 감사. 나는 야간에 그것을 검사하지 않았다. – aug70co

+0

봄 Oauth2 버전 2.0.1.RELEASE가 이번 달에 릴리스되었습니다. –