// 底层实现 publicclassBadPracticeServiceA{ publiclonggetPersonIdByPersonUUID(String personUuid){ Long person = getPersonId(); if (person == null) { thrownew ServiceApplicationException("Can not find PersonID by PersonUUID"); } return person; } }
// 作为上层的调用者,我在调用上述方法的时候不得不显示的处理他抛出的异常 try { long target = badPracticeServiceA.getPersonIdByPersonUUID("uuid"); } catch (IllegalStateException e) { log.info("Exception when get person id by person uuid {}, detail log msg: {}", "uuid", e.getMessage()); }
allows the SFV4 client/Quartz Job to execute service
Any Login User
user
any user authenticated via /login or /samllogin
还有一个很神奇的 User type, Anonymous, ParamBean 有一个方法 getAnonymousPrincipal() 注释说,这个 type 表示一个没有经过授权的 user, 猜测,比如,登陆前需要做一些测试,比如看 account 是否存在,这个时候就要用到这种类型的 user type 了。
public class AppsecConfigListener implements ServletContextListener 这个 class 被注册到 web.xml 中,看实现的接口应该是 servlet 启动结束后,到各个 module 中的加载 feature 和 role 的配置信息。
GenericAuthorizationFilter 每次结束之后会将 appsec current user 置为 null
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
09:35:44,710 ERROR [AuditConfigExecutor] getConfigsFromDb error, company:QAAUTOCAND_RCMGoldenApp7. sf_class=com.successfactors.appsec.AbstractAccessController line=39 method=assertAuthorizedFor depth=1 AccessDeniedException{user=[RCMGoldenApp7,RCMGoldenApp7,QAAUTOCAND_RCMGoldenApp7.,dbPool1,null,null,en_US] , activity=Activity{type=SERVICE, name='com.successfactors.auditloggingservice.service.audit.command.AuditConfigQueryCmd', context=null}} at com.successfactors.appsec.AbstractAccessController.assertAuthorizedFor(AbstractAccessController.java:39) at com.successfactors.appsec.AppSec.assertAuthorizedForService(AppSec.java:231) at com.successfactors.sca.ServiceCommandEngine.authorizeService(ServiceCommandEngine.java:312) at com.successfactors.sca.ServiceCommandEngine.execute(ServiceCommandEngine.java:238) at com.successfactors.sca.service.spring.ServiceCommandProcessorSpring.execute(ServiceCommandProcessorSpring.java:451) at com.successfactors.sca.service.handler.spring.SpringAppSCAHandler.execute(SpringAppSCAHandler.java:36) at com.successfactors.auditloggingservice.service.audit.executor.AuditConfigExecutor.getConfigsFromDb(AuditConfigExecutor.java:85) at com.successfactors.auditloggingservice.service.audit.executor.AuditConfigExecutor.getConfigValue(AuditConfigExecutor.java:55) at com.successfactors.auditloggingservice.service.audit.executor.AuditConfigExecutor.getConfigValue(AuditConfigExecutor.java:49) at com.successfactors.auditloggingservice.service.audit.executor.AuditKafkaSaveExecutor.needSave(AuditKafkaSaveExecutor.java:118) at com.successfactors.auditloggingservice.service.audit.executor.AuditKafkaSaveExecutor.update(AuditKafkaSaveExecutor.java:80) at com.successfactors.auditloggingservice.service.audit.executor.AuditKafkaSaveExecutor.lambda$0(AuditKafkaSaveExecutor.java:69) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
// Start to record time cost for scope: Request // special filter logic... // filterChain.doFilter(request, response) // Stop record, print time cost: xx ms
// 终端输出如下: // ------------------------------> msg, e <------------------------------ // INFO [main] (ExpClient.java:14) - err... // java.lang.ArithmeticException: / by zero // at sementic.ExpTest.testMethod(ExpTest.java:5) // at sementic.ExpClient.main(ExpClient.java:11) // ------------------------------> e <------------------------------ // INFO [main] (ExpClient.java:16) - java.lang.ArithmeticException: / by zero // ------------------------------> msg <------------------------------ // INFO [main] (ExpClient.java:18) - / by zero