mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 01:02:14 +00:00
Fix compiling in Eclipse
This commit is contained in:
parent
39d544b901
commit
02c3565e22
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011 the original author or authors.
|
* Copyright 2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -108,7 +108,6 @@ public class ServiceAuthenticationDetailsSource implements AuthenticationDetails
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
if(serviceProperties == null) {
|
if(serviceProperties == null) {
|
||||||
serviceProperties = applicationContext.getBean(ServiceProperties.class);
|
serviceProperties = applicationContext.getBean(ServiceProperties.class);
|
||||||
|
@ -204,7 +204,7 @@ class LdapAuthenticationProviderBuilderSecurityBuilderTests extends BaseSpringSp
|
|||||||
auth.build()
|
auth.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void configure(AuthenticationManagerBuilder auth)
|
abstract protected void configure(AuthenticationManagerBuilder auth) throws Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
static Integer port;
|
static Integer port;
|
||||||
|
@ -62,7 +62,7 @@ public class MessageSecurityMetadataSourceRegistry {
|
|||||||
* from. Uses {@link MessageSecurityMetadataSourceRegistry#pathMatcher(PathMatcher)}.
|
* from. Uses {@link MessageSecurityMetadataSourceRegistry#pathMatcher(PathMatcher)}.
|
||||||
*
|
*
|
||||||
* @return the {@link Constraint} that is associated to the {@link MessageMatcher}
|
* @return the {@link Constraint} that is associated to the {@link MessageMatcher}
|
||||||
* @see {@link MessageSecurityMetadataSourceRegistry#pathMatcher(PathMatcher)}
|
* @see {@link MessageSecurityMetadataSourceRegistry#pathMatcher(PathMatcher)}
|
||||||
*/
|
*/
|
||||||
public Constraint destinationMatchers(String... patterns) {
|
public Constraint destinationMatchers(String... patterns) {
|
||||||
List<MatcherBuilder> matchers = new ArrayList<MatcherBuilder>(patterns.length);
|
List<MatcherBuilder> matchers = new ArrayList<MatcherBuilder>(patterns.length);
|
||||||
@ -278,7 +278,6 @@ public class MessageSecurityMetadataSourceRegistry {
|
|||||||
this.matcher = matcher;
|
this.matcher = matcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MessageMatcher<?> build() {
|
public MessageMatcher<?> build() {
|
||||||
return matcher;
|
return matcher;
|
||||||
}
|
}
|
||||||
@ -291,7 +290,6 @@ public class MessageSecurityMetadataSourceRegistry {
|
|||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MessageMatcher<?> build() {
|
public MessageMatcher<?> build() {
|
||||||
return new SimpDestinationMessageMatcher(pattern, pathMatcher);
|
return new SimpDestinationMessageMatcher(pattern, pathMatcher);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ import java.util.List;
|
|||||||
@Order(Ordered.HIGHEST_PRECEDENCE + 100)
|
@Order(Ordered.HIGHEST_PRECEDENCE + 100)
|
||||||
public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends AbstractWebSocketMessageBrokerConfigurer {
|
public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends AbstractWebSocketMessageBrokerConfigurer {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerStompEndpoints(StompEndpointRegistry registry) {}
|
public void registerStompEndpoints(StompEndpointRegistry registry) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -465,7 +465,6 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean, A
|
|||||||
|
|
||||||
private static class NoOpAuthenticationManager implements AuthenticationManager {
|
private static class NoOpAuthenticationManager implements AuthenticationManager {
|
||||||
|
|
||||||
@Override
|
|
||||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||||
throw new AuthenticationServiceException("Cannot authenticate " + authentication);
|
throw new AuthenticationServiceException("Cannot authenticate " + authentication);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,6 @@ public class SecurityEvaluationContextExtension extends EvaluationContextExtensi
|
|||||||
this.authentication = authentication;
|
this.authentication = authentication;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtensionId() {
|
public String getExtensionId() {
|
||||||
return "security";
|
return "security";
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,12 @@ task integrationTest(type: Test, dependsOn: jar) {
|
|||||||
junitXml.destination = project.file("$project.buildDir/integration-test-results/")
|
junitXml.destination = project.file("$project.buildDir/integration-test-results/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
classpath {
|
||||||
|
plusConfigurations += [ configurations.integrationTestCompile ]
|
||||||
|
}
|
||||||
|
}
|
||||||
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
|
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
|
||||||
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
|
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
|
||||||
check.dependsOn integrationTest
|
check.dependsOn integrationTest
|
||||||
|
@ -114,7 +114,6 @@ public class LdapAuthority implements GrantedAuthority {
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public String getAuthority() {
|
public String getAuthority() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,11 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
|||||||
return metadataSource;
|
return metadataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||||
InterceptorStatusToken token = beforeInvocation(message);
|
InterceptorStatusToken token = beforeInvocation(message);
|
||||||
return token == null ? message : new TokenMessage(message,token);
|
return token == null ? message : new TokenMessage(message,token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
|
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
|
||||||
if(!(message instanceof TokenMessage)) {
|
if(!(message instanceof TokenMessage)) {
|
||||||
// TODO What if other classes return another instance too?
|
// TODO What if other classes return another instance too?
|
||||||
@ -81,7 +79,6 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
|||||||
afterInvocation(token, null);
|
afterInvocation(token, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex) {
|
public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex) {
|
||||||
if(!(message instanceof TokenMessage)) {
|
if(!(message instanceof TokenMessage)) {
|
||||||
// TODO What if other classes return another instance too?
|
// TODO What if other classes return another instance too?
|
||||||
@ -95,12 +92,10 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
|
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex) {
|
public void afterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,12 +112,10 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MessageHeaders getHeaders() {
|
public MessageHeaders getHeaders() {
|
||||||
return delegate.getHeaders();
|
return delegate.getHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getPayload() {
|
public Object getPayload() {
|
||||||
return delegate.getPayload();
|
return delegate.getPayload();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
|||||||
this.messageMap = messageMap;
|
this.messageMap = messageMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
|
public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
|
||||||
final Message message = (Message) object;
|
final Message message = (Message) object;
|
||||||
for (Map.Entry<MessageMatcher<?>, Collection<ConfigAttribute>> entry : messageMap.entrySet()) {
|
for (Map.Entry<MessageMatcher<?>, Collection<ConfigAttribute>> entry : messageMap.entrySet()) {
|
||||||
@ -55,7 +54,6 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||||
Set<ConfigAttribute> allAttributes = new HashSet<ConfigAttribute>();
|
Set<ConfigAttribute> allAttributes = new HashSet<ConfigAttribute>();
|
||||||
|
|
||||||
@ -66,7 +64,6 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
|||||||
return allAttributes;
|
return allAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supports(Class<?> clazz) {
|
public boolean supports(Class<?> clazz) {
|
||||||
return Message.class.isAssignableFrom(clazz);
|
return Message.class.isAssignableFrom(clazz);
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,11 @@ public final class SecurityContextChannelInterceptor extends ChannelInterceptorA
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) {
|
public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) {
|
||||||
setup(message);
|
setup(message);
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex) {
|
public void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex) {
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,6 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
|
|||||||
this(pattern, new AntPathMatcher());
|
this(pattern, new AntPathMatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(Message<? extends Object> message) {
|
public boolean matches(Message<? extends Object> message) {
|
||||||
String destination = SimpMessageHeaderAccessor.getDestination(message.getHeaders());
|
String destination = SimpMessageHeaderAccessor.getDestination(message.getHeaders());
|
||||||
return destination != null && matcher.match(pattern, destination);
|
return destination != null && matcher.match(pattern, destination);
|
||||||
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface SecurityMessageRepository extends MessageRepository {
|
public interface SecurityMessageRepository extends MessageRepository {
|
||||||
@Override
|
|
||||||
@Query("select m from Message m where m.to.id = ?#{ principal?.id }")
|
@Query("select m from Message m where m.to.id = ?#{ principal?.id }")
|
||||||
List<Message> findAll();
|
List<Message> findAll();
|
||||||
}
|
}
|
@ -207,7 +207,6 @@ public final class SecurityMockMvcRequestPostProcessors {
|
|||||||
this.certificates = certificates;
|
this.certificates = certificates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) {
|
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) {
|
||||||
request.setAttribute("javax.servlet.request.X509Certificate", certificates);
|
request.setAttribute("javax.servlet.request.X509Certificate", certificates);
|
||||||
return request;
|
return request;
|
||||||
@ -340,7 +339,6 @@ public final class SecurityMockMvcRequestPostProcessors {
|
|||||||
+ "\", response=\"" + responseDigest + "\", qop=" + qop + ", nc=" + nc + ", cnonce=\"" + cnonce + "\"";
|
+ "\", response=\"" + responseDigest + "\", qop=" + qop + ", nc=" + nc + ", cnonce=\"" + cnonce + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) {
|
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) {
|
||||||
|
|
||||||
request.addHeader("Authorization",
|
request.addHeader("Authorization",
|
||||||
@ -465,7 +463,6 @@ public final class SecurityMockMvcRequestPostProcessors {
|
|||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
|
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
|
||||||
SecurityContext result = getContext(requestResponseHolder.getRequest());
|
SecurityContext result = getContext(requestResponseHolder.getRequest());
|
||||||
// always load from the delegate to ensure the request/response in the holder are updated
|
// always load from the delegate to ensure the request/response in the holder are updated
|
||||||
@ -474,13 +471,11 @@ public final class SecurityMockMvcRequestPostProcessors {
|
|||||||
return result == null ? delegateResult : result;
|
return result == null ? delegateResult : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) {
|
public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) {
|
||||||
request.setAttribute(ATTR_NAME, context);
|
request.setAttribute(ATTR_NAME, context);
|
||||||
delegate.saveContext(context, request, response);
|
delegate.saveContext(context, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean containsContext(HttpServletRequest request) {
|
public boolean containsContext(HttpServletRequest request) {
|
||||||
return getContext(request) != null || delegate.containsContext(request);
|
return getContext(request) != null || delegate.containsContext(request);
|
||||||
}
|
}
|
||||||
|
@ -35,37 +35,30 @@ public class CustomUserDetails implements UserDetails {
|
|||||||
this.authorities = AuthorityUtils.createAuthorityList("ROLE_USER");
|
this.authorities = AuthorityUtils.createAuthorityList("ROLE_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
return authorities;
|
return authorities;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAccountNonExpired() {
|
public boolean isAccountNonExpired() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAccountNonLocked() {
|
public boolean isAccountNonLocked() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCredentialsNonExpired() {
|
public boolean isCredentialsNonExpired() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import java.util.List;
|
|||||||
* @author Rob Winch
|
* @author Rob Winch
|
||||||
*/
|
*/
|
||||||
public class WithMockCustomUserSecurityContextFactory implements WithSecurityContextFactory<WithMockCustomUser> {
|
public class WithMockCustomUserSecurityContextFactory implements WithSecurityContextFactory<WithMockCustomUser> {
|
||||||
@Override
|
|
||||||
public SecurityContext createSecurityContext(WithMockCustomUser customUser) {
|
public SecurityContext createSecurityContext(WithMockCustomUser customUser) {
|
||||||
SecurityContext context = SecurityContextHolder.createEmptyContext();
|
SecurityContext context = SecurityContextHolder.createEmptyContext();
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ public class WithUserDetailsTests {
|
|||||||
|
|
||||||
static class CustomUserDetailsService implements UserDetailsService {
|
static class CustomUserDetailsService implements UserDetailsService {
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
|
||||||
return new CustomUserDetails("name", username);
|
return new CustomUserDetails("name", username);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ public class SecurityMockMvcRequestPostProcessorsDigestTests {
|
|||||||
entryPoint.setRealmName("Spring Security");
|
entryPoint.setRealmName("Spring Security");
|
||||||
filter = new DigestAuthenticationFilter();
|
filter = new DigestAuthenticationFilter();
|
||||||
filter.setUserDetailsService(new UserDetailsService() {
|
filter.setUserDetailsService(new UserDetailsService() {
|
||||||
@Override
|
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
return new User(username,password, AuthorityUtils.createAuthorityList("ROLE_USER"));
|
return new User(username,password, AuthorityUtils.createAuthorityList("ROLE_USER"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user