303.4. 在 Camel 路由中应用 Shiro 身份验证
ShiroSecurityPolicy、测试并允许在 Message Header 中包含加密安全Token 的传入消息交换,以进一步进行后续身份验证。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"); } }; }