SlideShare a Scribd company logo
MULE –Component Authorization
Using Spring Security
2
Component Authorization Using Spring Security
This page describes how you can configure method-level authorization
using Spring Security on your components so that users with different roles
can only invoke certain methods.
3
Securing Flow Components
To secure MethodInvocations, you must add a properly configured
MethodSecurityInterceptor into the application context. The beans requiring
security are chained into the interceptor. This chaining is accomplished
using Spring’s ProxyFactoryBean or BeanNameAutoProxyCreator.
Alternatively, Spring Security provides a MethodDefinitionSourceAdvisor,
which you can use with Spring’s DefaultAdvisorAutoProxyCreator to
automatically chain the security interceptor in front of any beans defined
against the MethodSecurityInterceptor.
4
In addition to the daoAuthenticationProvider and inMemoryDaoImpl beans
(see Configuring Security), the following beans must be configured:
MethodSecurityInterceptor
AuthenticationManager
AccessDecisionManager
AutoProxyCreator
RoleVoter
5
The MethodSecurityInterceptor
The MethodSecurityInterceptor is configured with a reference to the
following:
AuthenticationManager
AccessDecisionManager
6
Following is a security interceptor for intercepting calls made to the
methods of a component myComponent, which defines two methods:
delete and writeSomething. Roles are set on these methods as seen below
in the property securityMetadataSource.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mule="http://www.mulesource.org/schema/mule/core"
xmlns:mule-ss="http://www.mulesource.org/schema/mule/spring-security"
...cut...
<bean id="myComponentSecurity"
class="org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="securityMetadataSource">
<value>
com.foo.myComponent.delete=ROLE_ADMIN
com.foo.myComponent.writeSomething=ROLE_ANONYMOUS
</value>
</property>
</bean>
7
The AuthenticationManager
This bean is responsible for passing requests through a chain of AuthenticationProvider objects.
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
<property name= "providers">
<list>
<ref local="daoAuthenticationProvider"/>
</list>
</property>
</bean>
8
The AccessDecisionManager
This bean specifies that a user can access the protected methods if they
have any one of the roles specified in the securityMetadataSource.
<bean id="accessDecisionManager"
class='org.springframework.security.access.vote.AffirmativeBased'>
<property name="decisionVoters">
<list>
<ref bean="roleVoter"/>
</list>
</property>
</bean>
9
The AutoProxyCreator
This bean defines a proxy for the protected bean. When an application
asks Spring for a myComponent bean, it will get this proxy instead.
<bean id="autoProxyCreator"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames">
<list>
<value>myComponentSecurity</value>
</list>
</property>
<property name="beanNames">
<list>
<value>myComponent</value>
</list>
</property>
<property name='proxyTargetClass' value="true"/>
</bean>
Security authorizationusingspringsecurity-sathyaraj

More Related Content

PPT
Mule security - authorization using spring security
PDF
persentation
PPT
Mule security-jaas
PPT
Mule security - jaas
PPTX
Preventive Maintenance on Operating Systems
DOC
SalemPhilip_ResearchReport
PPTX
Id fiware upm-dit
PDF
What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...
Mule security - authorization using spring security
persentation
Mule security-jaas
Mule security - jaas
Preventive Maintenance on Operating Systems
SalemPhilip_ResearchReport
Id fiware upm-dit
What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...

Viewers also liked (16)

PPTX
Jean piaget
PPTX
Պատմիչ Կորյուն
PPTX
Colegio nacional nicolas esguerra
DOCX
Dosa besar
PPTX
Consejos para un periodista de viajes
PDF
Eureka52
PPTX
Danii ned
PDF
Nayoon_Sams-Resume
PPTX
PPTX
III Jornadas Nacionales de la Farmacia Rural
PPTX
Presentaciã³n1[1]
PPSX
Nicolas esguerra (4)
PPTX
Daniela fresco
PDF
Market Analysis: Softs and Grains week ended Nov 11, 2016
PPTX
Consejos para un periodista de viajes
Jean piaget
Պատմիչ Կորյուն
Colegio nacional nicolas esguerra
Dosa besar
Consejos para un periodista de viajes
Eureka52
Danii ned
Nayoon_Sams-Resume
III Jornadas Nacionales de la Farmacia Rural
Presentaciã³n1[1]
Nicolas esguerra (4)
Daniela fresco
Market Analysis: Softs and Grains week ended Nov 11, 2016
Consejos para un periodista de viajes
Ad

Similar to Security authorizationusingspringsecurity-sathyaraj (20)

PPTX
Spring Security services for web applications
PDF
Spring Security
PPT
Web Security Patterns - Jazoon 2010 - Zurich
PDF
Spring security4.x
PDF
Spring security jwt tutorial toptal
PPT
Developing With JAAS
PPTX
Spring Security Framework
PPT
Mule security jaas
PPT
Mule security jaas
PPT
Mule security jaas
PPT
Mule security jaas
PPT
Mule security - jaas
PPT
Mule security - jaas
PPT
Mule security jaas
PPT
Mule security jaas
PPT
Mule security - jaas
PDF
Azure Security Best Practises for Enterprises
PDF
Java EE Services
PPT
MULE-JAAS
PPTX
Web security
Spring Security services for web applications
Spring Security
Web Security Patterns - Jazoon 2010 - Zurich
Spring security4.x
Spring security jwt tutorial toptal
Developing With JAAS
Spring Security Framework
Mule security jaas
Mule security jaas
Mule security jaas
Mule security jaas
Mule security - jaas
Mule security - jaas
Mule security jaas
Mule security jaas
Mule security - jaas
Azure Security Best Practises for Enterprises
Java EE Services
MULE-JAAS
Web security
Ad

More from sathyaraj Anand (8)

PPTX
Mule message processor or routers
PPT
Mule cloudhubconsoleoverview-sathyaraj
PPT
Security springsecuritymanager-sathyaraj
PPTX
Mule esb
PPTX
Rest web services
PPTX
Mule esb mule message
PPTX
Mule filters
PPTX
Mule expression language
Mule message processor or routers
Mule cloudhubconsoleoverview-sathyaraj
Security springsecuritymanager-sathyaraj
Mule esb
Rest web services
Mule esb mule message
Mule filters
Mule expression language

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MYSQL Presentation for SQL database connectivity

Security authorizationusingspringsecurity-sathyaraj

  • 2. 2 Component Authorization Using Spring Security This page describes how you can configure method-level authorization using Spring Security on your components so that users with different roles can only invoke certain methods.
  • 3. 3 Securing Flow Components To secure MethodInvocations, you must add a properly configured MethodSecurityInterceptor into the application context. The beans requiring security are chained into the interceptor. This chaining is accomplished using Spring’s ProxyFactoryBean or BeanNameAutoProxyCreator. Alternatively, Spring Security provides a MethodDefinitionSourceAdvisor, which you can use with Spring’s DefaultAdvisorAutoProxyCreator to automatically chain the security interceptor in front of any beans defined against the MethodSecurityInterceptor.
  • 4. 4 In addition to the daoAuthenticationProvider and inMemoryDaoImpl beans (see Configuring Security), the following beans must be configured: MethodSecurityInterceptor AuthenticationManager AccessDecisionManager AutoProxyCreator RoleVoter
  • 5. 5 The MethodSecurityInterceptor The MethodSecurityInterceptor is configured with a reference to the following: AuthenticationManager AccessDecisionManager
  • 6. 6 Following is a security interceptor for intercepting calls made to the methods of a component myComponent, which defines two methods: delete and writeSomething. Roles are set on these methods as seen below in the property securityMetadataSource. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mule="http://www.mulesource.org/schema/mule/core" xmlns:mule-ss="http://www.mulesource.org/schema/mule/spring-security" ...cut... <bean id="myComponentSecurity" class="org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor"> <property name="authenticationManager" ref="authenticationManager"/> <property name="accessDecisionManager" ref="accessDecisionManager"/> <property name="securityMetadataSource"> <value> com.foo.myComponent.delete=ROLE_ADMIN com.foo.myComponent.writeSomething=ROLE_ANONYMOUS </value> </property> </bean>
  • 7. 7 The AuthenticationManager This bean is responsible for passing requests through a chain of AuthenticationProvider objects. <bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager"> <property name= "providers"> <list> <ref local="daoAuthenticationProvider"/> </list> </property> </bean>
  • 8. 8 The AccessDecisionManager This bean specifies that a user can access the protected methods if they have any one of the roles specified in the securityMetadataSource. <bean id="accessDecisionManager" class='org.springframework.security.access.vote.AffirmativeBased'> <property name="decisionVoters"> <list> <ref bean="roleVoter"/> </list> </property> </bean>
  • 9. 9 The AutoProxyCreator This bean defines a proxy for the protected bean. When an application asks Spring for a myComponent bean, it will get this proxy instead. <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <value>myComponentSecurity</value> </list> </property> <property name="beanNames"> <list> <value>myComponent</value> </list> </property> <property name='proxyTargetClass' value="true"/> </bean>