خرید بک لینک

Vote count: 0

I'm doing with spring security. When i browser http://localhost:8080/rest/user/json/quypham then occur following error:

[WARNING] /rest/user/json/quypham java.lang.IllegalArgumentException: Failed to evaluate expression 'ROLE_ADMIN' at org.springframework.security.access.expression.ExpressionUtils.evalua teAsBoolean(ExpressionUtils.java:15) at org.springframework.security.web.access.expression.WebExpressionVoter .vote(WebExpressionVoter.java:36) at org.springframework.security.web.access.expression.WebExpressionVoter .vote(WebExpressionVoter.java:18) at org.springframework.security.access.vote.AffirmativeBased.decide(Affi rmativeBased.java:62) at org.springframework.security.access.intercept.AbstractSecurityInterce ptor.beforeInvocation(AbstractSecurityInterceptor.java:232) at org.springframework.security.web.access.intercept.FilterSecurityInter

Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: (pos 0): Property or field 'ROLE_ADMIN' caot be found on object of type 'org.s pringframework.security.web.access.expression.WebSecurityExpressionRoot' - maybe not public? at org.springframework.expression.spel.ast.PropertyOrFieldReference.read Property(PropertyOrFieldReference.java:215) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getV alueInteal(PropertyOrFieldReference.java:85) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getV alueInteal(PropertyOrFieldReference.java:78) at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(Sp elNodeImpl.java:114) at org.springframework.expression.spel.standard.SpelExpression.getValue( SpelExpression.java:105) at org.springframework.security.access.expression.ExpressionUtils.evalua

I think to have wrong somthing in file userservice-servlet.xml, please let me know.

Here file userservice-servlet.xml

<security:http>
        <security:http-basic/>
        <security:intercept-url patte="/rest/**" access="ROLE_ADMIN"/>

    </security:http>

    <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider>
            <security:user-service>
                <security:user name="datpham" password="Dat12345" authorities="ROLE_ADMIN"/>
                <security:user name="hoaipham" password="Hoai12345" authorities="ROLE_USER"/>
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager>

Here file UserRestServiceController.java

@Controller
public class UserRestServiceController {
    @Autowired
    public  UserDao userDao;
    @Autowired
    public View jsonTemplate;
//  @RequestMapping(value = "/rest/user/list", produces = MediaType.APPLICATION_JSON_VALUE,method = RequestMethod.GET)
    @RequestMapping(value="/rest/user/json/{useame}",
            produces = MediaType.APPLICATION_JSON_VALUE,method = RequestMethod.GET)
    public @ResponseBody User loadUser(@PathVariable("useame") String name){
        retu userDao.loadUser(name);
    }

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 20 فروردين 1395 ساعت: 8:25

صفحه بندی