303.4. 在 Camel Route 上应用 Shiro 身份验证
ShiroSecurityPolicy、测试并允许传入的消息交换在 Message Header 中包含加密的 SecurityToken,以继续以下正确身份验证。SecurityToken 对象包含一个 Username/Password 详情,用于确定用户是有效用户的位置。
protected RouteBuilder createRouteBuilder() throws Exception { final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("classpath:shiro.ini", passPhrase); return new RouteBuilder() { public void configure() { onException(UnknownAccountException.class). to("mock:authenticationException"); onException(IncorrectCredentialsException.class). to("mock:authenticationException"); onException(LockedAccountException.class). to("mock:authenticationException"); onException(AuthenticationException.class). to("mock:authenticationException"); from("direct:secureEndpoint"). to("log:incoming payload"). policy(securityPolicy). to("mock:success"); } }; }