/** * Specify that Messages are allowed by anonymous users. * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry anonymous() { return access(anonymous); }
/** * Maps any {@link Message} that has a null SimpMessageHeaderAccessor destination * header (i.e. CONNECT, CONNECT_ACK, HEARTBEAT, UNSUBSCRIBE, DISCONNECT, * DISCONNECT_ACK, OTHER) * * @return the Expression to associate */ public Constraint nullDestMatcher() { return matchers(SimpDestinationMessageMatcher.NULL_DESTINATION_MATCHER); }
@Override protected boolean isSimpDestPathMatcherConfigured() { return super.isSimpDestPathMatcherConfigured(); } }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestMatchers("/app/a/*").permitAll() .anyMessage().denyAll(); } // @formatter:on
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages.nullDestMatcher().authenticated() // <1> .simpSubscribeDestMatchers("/user/queue/errors").permitAll() // <2> .simpDestMatchers("/app/**").hasRole("USER") // <3> .simpSubscribeDestMatchers("/user/**", "/topic/friends/*") .hasRole("USER") // <4> .simpTypeMatchers(MESSAGE, SUBSCRIBE).denyAll() // <5> .anyMessage().denyAll(); // <6> } }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .anyMessage().access("denyRob()"); } // @formatter:on
@Override protected boolean containsMapping() { return super.containsMapping(); }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestMatchers("/permitAll/**").permitAll() .simpDestMatchers("/beanResolver/**").access("@security.check()") .anyMessage().denyAll(); } // @formatter:on
/** * Specify that Messages are allowed by users that have been remembered. * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization * @see RememberMeConfigurer */ public MessageSecurityMetadataSourceRegistry rememberMe() { return access(rememberMe); }
/** * Maps any {@link Message} to a security expression. * * @return the Expression to associate */ public Constraint anyMessage() { return matchers(MessageMatcher.ANY_MESSAGE); }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestMatchers("/permitAll/**").permitAll() .simpDestMatchers("/customExpression/**").access("denyRob") .anyMessage().denyAll(); } // @formatter:on
/** * Specify that Messages are allowed by any authenticated user. * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry authenticated() { return access(authenticated); }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestMatchers("/app/a.*").permitAll() .anyMessage().denyAll(); } // @formatter:on
/** * Specify that Messages are allowed by users who have authenticated and were not * "remembered". * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization * @see RememberMeConfigurer */ public MessageSecurityMetadataSourceRegistry fullyAuthenticated() { return access(fullyAuthenticated); }
@Override protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestPathMatcher(new AntPathMatcher()) .simpDestMatchers("/app/a/*").permitAll() .anyMessage().denyAll(); } // @formatter:on
/** * Specify that {@link Message} instances require a particular authority. * * @param authority the authority to require (i.e. ROLE_USER, ROLE_ADMIN, etc). * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry hasAuthority(String authority) { return access(MessageSecurityMetadataSourceRegistry.hasAuthority(authority)); }
/** * Specify that Messages are not allowed by anyone. * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry denyAll() { return access(denyAll); }
/** * Specify that Messages are allowed by anyone. * * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry permitAll() { return access(permitAll); }
/** * Shortcut for specifying {@link Message} instances require any of a number of * roles. If you do not want to have "ROLE_" automatically inserted see * {@link #hasAnyAuthority(String...)} * * @param roles the roles to require (i.e. USER, ADMIN, etc). Note, it should not * start with "ROLE_" as this is automatically inserted. * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry hasAnyRole(String... roles) { return access(MessageSecurityMetadataSourceRegistry.hasAnyRole(roles)); }
/** * Shortcut for specifying {@link Message} instances require a particular role. If * you do not want to have "ROLE_" automatically inserted see * {@link #hasAuthority(String)}. * * @param role the role to require (i.e. USER, ADMIN, etc). Note, it should not * start with "ROLE_" as this is automatically inserted. * @return the {@link MessageSecurityMetadataSourceRegistry} for further * customization */ public MessageSecurityMetadataSourceRegistry hasRole(String role) { return access(MessageSecurityMetadataSourceRegistry.hasRole(role)); }