public CustomUserDetails(User user) { this.username = user.getUsername(); this.password = user.getPassword(); this.authorities = translate(user.getRoles()); }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return new CustomUserDetails(repository.findByUsername(username)); } };
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(clientDetailsUserService()); }
@Autowired public void authenticationManager(AuthenticationManagerBuilder builder, UserRepository repository) throws Exception { if (repository.count()==0) { repository.save(new User("user", "password", Arrays.asList(new Role("USER"), new Role("ACTUATOR")))); } builder.userDetailsService(userDetailsService(repository)); }
@Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.authorizationCodeServices(authorizationCodeServices()) .authenticationManager(auth).tokenStore(tokenStore()) .approvalStoreDisabled(); }
@Test public void testGetGreetingJava() { assertEquals( HelloWorldKt.getGreeting(), new JavaClass().getKotlinGreeting(), "Java and kotlin greeting should be the same"); } }
public String getKotlinGreeting() { return HelloWorldKt.getGreeting(); } }
@Override public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception { oauthServer.authenticationEntryPoint(authenticationEntryPoint()).accessDeniedHandler(accessDeniedHandler()); }
private AccessDeniedHandler accessDeniedHandler() { OAuth2AccessDeniedHandler accessDeniedHandler = new OAuth2AccessDeniedHandler(); accessDeniedHandler.setExceptionRenderer(exceptionRenderer()); return accessDeniedHandler; }
package demo; import javafx.scene.control.ListCell; public class ListViewCell extends ListCell<String> { @Override public void updateItem(String string, boolean empty) { super.updateItem(string,empty); if(string != null) { Data data = new Data(); data.setInfo(string); setGraphic(data.getBox()); } } }
@Override public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { security.addTokenEndpointAuthenticationFilter(new HardCodedAuthenticationFilter()); } }
@Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.authenticationManager(authenticationManager); endpoints.tokenGranter(tokenGranter(endpoints)); }
@Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.authenticationManager(authenticationManager).accessTokenConverter(accessTokenConverter()); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(clientDetailsUserService()); }
private AuthenticationEntryPoint authenticationEntryPoint() { OAuth2AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint(); authenticationEntryPoint.setExceptionRenderer(exceptionRenderer()); return authenticationEntryPoint; }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(clientDetailsUserService()); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(clientDetailsUserService()); }