开发者

OAuth for Spring Security - Howto implement resource declaration

I am trying and understand the next steps I have to take starting from the reference application at

http://svn.codehaus.org/spring-security-oauth/trunk/sparklr/

in order to create my own implementation. What I do not understand is where and how to declare dynamic resources for Oauth. In the reference app, resources are hard coded within the xml config:

   <bean id="photoServices" class="org.springframework.security.oauth.examples.sparklr.impl.PhotoServiceImpl">
    <property name="photos">
        <list>
            <bean class="org.springframework.security.oauth.examples.sparklr.PhotoInfo">
                <property name="id" value="1"/>
                <property name="name" value="photo1.jpg"/>
                <property name="userId" value="marissa"/>
                <property name="resourceURL"
                          value="/org/springframework/security/oauth/examples/sparklr/impl/resources/photo1.jpg"/>
            </bean>
            <bean class="org.springframework.security.oauth.exa开发者_如何学JAVAmples.sparklr.PhotoInfo">
                <property name="id" value="2"/>
                <property name="name" value="photo2.jpg"/>
                <property name="userId" value="paul"/>
                <property name="resourceURL"
                          value="/org/springframework/security/oauth/examples/sparklr/impl/resources/photo2.jpg"/>
            </bean>
             <!-- some more -->
        </list>
    </property>
   </bean>

I guess, this is no way to handle resources created by the users in the real world. So: How is this supposed to be done?


In the example shown above, it looks like the beans are pre-configured at design time and pre-loaded by Spring.

Did you consider actually creating and loading the beans dynamically during runtime?

This way, you can access the "photos" list whenever a new dynamic resource is created and add it directly to the list "photos"?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜