Class MessageSecurityMetadataSourceRegistry.Constraint
- java.lang.Object
-
- org.springframework.security.config.annotation.web.messaging.MessageSecurityMetadataSourceRegistry.Constraint
-
- Enclosing class:
- MessageSecurityMetadataSourceRegistry
public final class MessageSecurityMetadataSourceRegistry.Constraint extends java.lang.ObjectRepresents the security constraint to be applied to theMessageMatcherinstances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageSecurityMetadataSourceRegistryaccess(java.lang.String attribute)Allows specifying that Messages are secured by an arbitrary expressionMessageSecurityMetadataSourceRegistryanonymous()Specify that Messages are allowed by anonymous users.MessageSecurityMetadataSourceRegistryauthenticated()Specify that Messages are allowed by any authenticated user.MessageSecurityMetadataSourceRegistrydenyAll()Specify that Messages are not allowed by anyone.MessageSecurityMetadataSourceRegistryfullyAuthenticated()Specify that Messages are allowed by users who have authenticated and were not "remembered".MessageSecurityMetadataSourceRegistryhasAnyAuthority(java.lang.String... authorities)Specify thatMessageinstances requires any of a number authorities.MessageSecurityMetadataSourceRegistryhasAnyRole(java.lang.String... roles)Shortcut for specifyingMessageinstances require any of a number of roles.MessageSecurityMetadataSourceRegistryhasAuthority(java.lang.String authority)Specify thatMessageinstances require a particular authority.MessageSecurityMetadataSourceRegistryhasRole(java.lang.String role)Shortcut for specifyingMessageinstances require a particular role.MessageSecurityMetadataSourceRegistrypermitAll()Specify that Messages are allowed by anyone.MessageSecurityMetadataSourceRegistryrememberMe()Specify that Messages are allowed by users that have been remembered.
-
-
-
Method Detail
-
hasRole
public MessageSecurityMetadataSourceRegistry hasRole(java.lang.String role)
Shortcut for specifyingMessageinstances require a particular role. If you do not want to have "ROLE_" automatically inserted seehasAuthority(String).- Parameters:
role- the role to require (i.e. USER, ADMIN, etc). Note, it should not start with "ROLE_" as this is automatically inserted.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
hasAnyRole
public MessageSecurityMetadataSourceRegistry hasAnyRole(java.lang.String... roles)
Shortcut for specifyingMessageinstances require any of a number of roles. If you do not want to have "ROLE_" automatically inserted seehasAnyAuthority(String...)- Parameters:
roles- the roles to require (i.e. USER, ADMIN, etc). Note, it should not start with "ROLE_" as this is automatically inserted.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
hasAuthority
public MessageSecurityMetadataSourceRegistry hasAuthority(java.lang.String authority)
Specify thatMessageinstances require a particular authority.- Parameters:
authority- the authority to require (i.e. ROLE_USER, ROLE_ADMIN, etc).- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
hasAnyAuthority
public MessageSecurityMetadataSourceRegistry hasAnyAuthority(java.lang.String... authorities)
Specify thatMessageinstances requires any of a number authorities.- Parameters:
authorities- the requests require at least one of the authorities (i.e. "ROLE_USER","ROLE_ADMIN" would mean either "ROLE_USER" or "ROLE_ADMIN" is required).- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
permitAll
public MessageSecurityMetadataSourceRegistry permitAll()
Specify that Messages are allowed by anyone.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
anonymous
public MessageSecurityMetadataSourceRegistry anonymous()
Specify that Messages are allowed by anonymous users.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
rememberMe
public MessageSecurityMetadataSourceRegistry rememberMe()
Specify that Messages are allowed by users that have been remembered.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization - See Also:
RememberMeConfigurer
-
denyAll
public MessageSecurityMetadataSourceRegistry denyAll()
Specify that Messages are not allowed by anyone.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
authenticated
public MessageSecurityMetadataSourceRegistry authenticated()
Specify that Messages are allowed by any authenticated user.- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
fullyAuthenticated
public MessageSecurityMetadataSourceRegistry fullyAuthenticated()
Specify that Messages are allowed by users who have authenticated and were not "remembered".- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization - See Also:
RememberMeConfigurer
-
access
public MessageSecurityMetadataSourceRegistry access(java.lang.String attribute)
Allows specifying that Messages are secured by an arbitrary expression- Parameters:
attribute- the expression to secure the URLs (i.e. "hasRole('ROLE_USER') and hasRole('ROLE_SUPER')")- Returns:
- the
MessageSecurityMetadataSourceRegistryfor further customization
-
-