├── .gitignore ├── LICENSE ├── README.md ├── README.zh_CN.md ├── account ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── account │ │ ├── domain │ │ ├── model │ │ │ ├── AppRole.java │ │ │ ├── Gender.java │ │ │ ├── PasswordSaltProvider.java │ │ │ ├── RoleType.java │ │ │ ├── SysRole.java │ │ │ ├── User.java │ │ │ └── UserRoleRelationship.java │ │ └── request │ │ │ ├── AbstractUserRequest.java │ │ │ ├── ChangeUserProfileRequest.java │ │ │ ├── RoleQueryRequest.java │ │ │ ├── SaveImageRequest.java │ │ │ ├── SaveRoleRequest.java │ │ │ ├── SaveUserRequest.java │ │ │ ├── UserQueryRequest.java │ │ │ ├── UsernameQueryRequest.java │ │ │ └── UsersForRoleRequest.java │ │ ├── exception │ │ ├── PasscodeException.java │ │ ├── RegisterException.java │ │ ├── RoleException.java │ │ ├── RoleNotFoundException.java │ │ ├── UserException.java │ │ ├── UserNotFoundException.java │ │ ├── UserPasswordException.java │ │ └── UserRequiredException.java │ │ ├── service │ │ ├── AccountService.java │ │ ├── RoleService.java │ │ └── UserProfileService.java │ │ └── spi │ │ ├── AppRoleReference.java │ │ └── UserReference.java ├── impl │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── account │ │ ├── AccountPasswordConfigurationProperties.java │ │ ├── AccountServiceModuleConfiguration.java │ │ ├── repository │ │ ├── AppRoleRepository.java │ │ ├── UserRepository.java │ │ ├── UserRoleRelationshipRepository.java │ │ └── custom │ │ │ ├── UserRepositoryCustom.java │ │ │ └── impl │ │ │ └── UserRepositoryImpl.java │ │ └── service │ │ └── impl │ │ ├── RoleServiceImpl.java │ │ ├── UserAccountServiceImpl.java │ │ └── UserProfileServiceImpl.java ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── account │ │ ├── AccountInitializingBean.java │ │ ├── AccountMenuConfiguration.java │ │ ├── AccountMockModuleConfiguration.java │ │ ├── AccountRestModuleConfiguration.java │ │ ├── AdministratorAccountProperties.java │ │ └── rest │ │ ├── controller │ │ ├── AppRoleRestControler.java │ │ ├── ArchivedUserRestController.java │ │ ├── CurrentUserProfileRestController.java │ │ ├── SysRoleRestControler.java │ │ └── UserRestController.java │ │ ├── dto │ │ ├── AvatarSummary.java │ │ ├── Cellphone.java │ │ ├── ChangeMyPasswordRequest.java │ │ ├── ChangeMyProfileParameter.java │ │ ├── ChangePasswordRequest.java │ │ ├── ForgetPasswordParameter.java │ │ ├── RoleQueryParameter.java │ │ ├── RoleSummary.java │ │ ├── SaveImageParameter.java │ │ ├── SaveRoleParameter.java │ │ ├── SaveSortParameter.java │ │ ├── SaveUserParameter.java │ │ ├── UserDetail.java │ │ ├── UserProfile.java │ │ ├── UserQueryParameter.java │ │ ├── UserSummary.java │ │ ├── UsernamePageQueryParameter.java │ │ └── UsersForRoleParameter.java │ │ └── support │ │ ├── AppRoleRestSupport.java │ │ ├── ArchivedUserRestSupport.java │ │ ├── SysRoleRestSupport.java │ │ ├── UserProfileRestSupport.java │ │ ├── UserRestSupport.java │ │ ├── impl │ │ ├── AppRoleRestSupportImpl.java │ │ ├── ArchivedUserRestSupportImpl.java │ │ ├── SysRoleRestSupportImpl.java │ │ ├── UserProfileRestSupportImpl.java │ │ └── UserRestSupportImpl.java │ │ └── mock │ │ ├── AppRoleRestSupportMockImpl.java │ │ ├── ArchivedUserRestSupportMockImpl.java │ │ ├── SysRoleRestSupportMockImpl.java │ │ ├── UserProfileRestSupportMockImpl.java │ │ └── UserRestSupportMockImpl.java └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── audit ├── impl │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── audit │ │ ├── AuditServiceModuleConfiguration.java │ │ ├── domain │ │ ├── model │ │ │ ├── AggregationType.java │ │ │ ├── AuditEvent.java │ │ │ ├── AuditEventAggregation.java │ │ │ ├── AuthEvent.java │ │ │ └── AuthEventAggregation.java │ │ └── request │ │ │ ├── AuditEventQueryRequest.java │ │ │ └── AuthEventQueryRequest.java │ │ ├── event │ │ ├── RemoveAuditEventListener.java │ │ ├── RemoveAuthEventListener.java │ │ ├── RemoveEventConstants.java │ │ └── RemoveEventObject.java │ │ ├── exception │ │ ├── AuditEventException.java │ │ └── AuthEventException.java │ │ ├── repository │ │ ├── AuditEventAggregationRepository.java │ │ ├── AuditEventRepository.java │ │ ├── AuthEventAggregationRepository.java │ │ ├── AuthEventRepository.java │ │ └── custom │ │ │ ├── AuditEventRepositoryCustom.java │ │ │ ├── AuthEventRepositoryCustom.java │ │ │ └── impl │ │ │ ├── AuditEventRepositoryImpl.java │ │ │ └── AuthEventRepositoryImpl.java │ │ ├── service │ │ ├── AuditEventService.java │ │ ├── AuditEventStatisticsService.java │ │ ├── AuthEventService.java │ │ ├── AuthEventStatisticsService.java │ │ └── impl │ │ │ ├── AuditEventServiceImpl.java │ │ │ ├── AuditEventStatisticsServiceImpl.java │ │ │ ├── AuthEventServiceImpl.java │ │ │ └── AuthEventStatisticsServiceImpl.java │ │ └── spiImpl │ │ └── AuditEventPersisterImpl.java ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── audit │ │ ├── AuditMenuConfiguration.java │ │ ├── AuditMockModuleConfiguration.java │ │ ├── AuditRestModuleConfiguration.java │ │ └── rest │ │ ├── controller │ │ ├── AuditReportController.java │ │ ├── AuditRestController.java │ │ ├── AuthReportController.java │ │ └── AuthRestController.java │ │ ├── dto │ │ ├── AuditEventQueryParameter.java │ │ └── AuthEventQueryParameter.java │ │ └── support │ │ ├── AuditEventRestSupport.java │ │ ├── AuditReportRestSupport.java │ │ ├── AuthEventRestSupport.java │ │ ├── AuthReportRestSupport.java │ │ ├── impl │ │ ├── AuditEventRestSupportImpl.java │ │ ├── AuditReportRestSupportImpl.java │ │ ├── AuthEventRestSupportImpl.java │ │ └── AuthReportRestSupportImpl.java │ │ └── mock │ │ ├── AuditEventRestSupportMockImpl.java │ │ ├── AuditReportRestSupportMockImpl.java │ │ ├── AuthEventRestSupportMockImpl.java │ │ └── AuthReportRestSupportMockImpl.java └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── build.gradle ├── cloud ├── .env ├── README.md ├── docker-compose.yml └── eureka │ ├── build.gradle │ ├── gradle.properties │ └── src │ ├── docker │ ├── Dockerfile │ └── container_files │ │ └── docker-entrypoint.sh │ └── main │ ├── java │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── openapi │ │ ├── OpenApiApplication.java │ │ └── OpenApiWebMvcConfigurer.java │ └── resources │ ├── application.yml │ └── bootstrap.yml ├── gradle.properties ├── gradle ├── dependencies.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── identity ├── core │ ├── build.gradle │ └── gradle.properties └── impl │ ├── build.gradle │ └── gradle.properties ├── menu ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── menu │ │ ├── MenuModuleConfiguration.java │ │ ├── annotation │ │ ├── Action.java │ │ ├── EnableMenu.java │ │ ├── EnableMenuImportSelector.java │ │ ├── ExtensionPoint.java │ │ ├── Menu.java │ │ └── Metadata.java │ │ └── core │ │ ├── DefaultMenuPlugin.java │ │ ├── Menu.java │ │ ├── MenuException.java │ │ ├── MenuExtensionPoint.java │ │ ├── MenuJsonLoader.java │ │ ├── MenuLoader.java │ │ ├── MenuPlugin.java │ │ ├── MenuResourceProvider.java │ │ └── Menus.java ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── menu │ │ ├── GlobalMenuConfiguration.java │ │ ├── MenuMockModuleConfiguration.java │ │ ├── MenuRestModuleConfiguration.java │ │ └── rest │ │ ├── controller │ │ └── UserProfileExtensionRestController.java │ │ ├── dto │ │ └── Menu.java │ │ └── support │ │ ├── UserProfileExtensionRestSupport.java │ │ ├── impl │ │ └── UserProfileExtensionRestSupportImpl.java │ │ └── mock │ │ └── UserProfileExtensionRestSupportMockImpl.java └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── message └── sms │ ├── aliyun │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── sms │ │ ├── AliyunSmsModuleConfiguration.java │ │ └── aliyun │ │ ├── event │ │ └── PasscodeMessageEventListener.java │ │ └── impl │ │ ├── AdvancedAliyunOptions.java │ │ ├── AliyunOptions.java │ │ ├── SmsException.java │ │ └── SmsSenderAliyunImpl.java │ ├── history │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── sms │ │ └── history │ │ ├── SmsHistoryMenuConfiguration.java │ │ ├── SmsHistoryMockModuleConfiguration.java │ │ ├── SmsHistoryModuleConfiguration.java │ │ ├── domain │ │ ├── model │ │ │ └── SmsHistory.java │ │ └── request │ │ │ └── SmsHistoryQueryRequest.java │ │ ├── event │ │ └── SmsHistoryEventListener.java │ │ ├── repository │ │ ├── SmsHistoryRepository.java │ │ └── custom │ │ │ ├── SmsHistoryRepositoryCustom.java │ │ │ └── impl │ │ │ └── SmsHistoryRepositoryImpl.java │ │ ├── rest │ │ ├── controller │ │ │ └── SmsHistoryRestController.java │ │ ├── dto │ │ │ ├── SmsHistoriesQueryParameter.java │ │ │ ├── SmsHistoryQueryParameter.java │ │ │ └── SmsHistorySummary.java │ │ └── support │ │ │ ├── SmsHistorySupport.java │ │ │ ├── impl │ │ │ └── SmsHistorySupportImpl.java │ │ │ └── mock │ │ │ └── SmsHistorySupportMockImpl.java │ │ └── service │ │ ├── SmsHistoryService.java │ │ └── impl │ │ └── SmsHistoryServiceImpl.java │ ├── mock │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── sms │ │ ├── MockSmsModuleConfiguration.java │ │ └── mock │ │ └── PasscodeMessageEventListener.java │ ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── sms │ │ ├── DummySmsRestModuleConfiguration.java │ │ └── SmsRestModuleConfiguration.java │ └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── openapi ├── .env ├── doc │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── apidoc │ │ ├── OpenApiDocApplication.java │ │ └── SpringfoxConfiguration.java ├── docker-compose.yml └── server │ ├── build.gradle │ ├── gradle.properties │ └── src │ ├── docker │ ├── Dockerfile │ └── container_files │ │ ├── application.properties │ │ └── docker-entrypoint.sh │ └── main │ └── java │ └── in │ └── clouthink │ └── daas │ └── sbb │ └── openapi │ ├── OpenApiApplication.java │ └── OpenApiWebMvcConfigurer.java ├── passcode ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── passcode │ │ ├── engine │ │ └── PasscodeEngine.java │ │ ├── exception │ │ ├── PasscodeException.java │ │ └── RegisterException.java │ │ ├── model │ │ ├── Passcode.java │ │ ├── PasscodeMessage.java │ │ ├── PasscodeRequest.java │ │ └── Passcodes.java │ │ └── service │ │ └── PasscodeService.java └── impl │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── java │ └── in │ └── clouthink │ └── daas │ └── sbb │ └── passcode │ ├── PasscodeConfigurationProperties.java │ ├── PasscodeServiceModuleConfiguration.java │ ├── engine │ └── impl │ │ └── PasscodeEngineImpl.java │ ├── event │ └── PasscodeEventListener.java │ ├── repository │ └── PasscodeRepository.java │ └── service │ └── impl │ └── PasscodeServiceImpl.java ├── rbac ├── impl │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ ├── main │ │ ├── java │ │ │ └── in │ │ │ │ └── clouthink │ │ │ │ └── daas │ │ │ │ └── sbb │ │ │ │ └── rbac │ │ │ │ ├── RbacServiceModuleConfiguration.java │ │ │ │ └── impl │ │ │ │ ├── model │ │ │ │ ├── ResourceRoleRelationship.java │ │ │ │ └── TypedRole.java │ │ │ │ ├── repository │ │ │ │ └── ResourceRoleRelationshipRepository.java │ │ │ │ ├── service │ │ │ │ ├── impl │ │ │ │ │ └── PermissionServiceImpl.java │ │ │ │ └── support │ │ │ │ │ ├── RbacUtils.java │ │ │ │ │ ├── ResourceRoleRelationshipService.java │ │ │ │ │ └── impl │ │ │ │ │ └── ResourceRoleRelationshipServiceImpl.java │ │ │ │ └── spring │ │ │ │ └── security │ │ │ │ ├── RbacWebSecurityExpressionHandler.java │ │ │ │ └── RbacWebSecurityExpressionRoot.java │ │ └── resources │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── rbac │ │ │ └── impl │ │ │ └── extension │ │ │ └── resources.json │ │ └── test │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── rbac │ │ │ └── impl │ │ │ └── test │ │ │ └── ResourceLoaderTest.java │ │ └── resources │ │ └── in.clouthink.daas.appt.rbac.impl.sample.json ├── permission │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── rbac │ │ ├── exception │ │ ├── PermissionException.java │ │ └── PermissionNotFoundException.java │ │ ├── model │ │ ├── DefaultPermission.java │ │ ├── DefaultRole.java │ │ ├── Permission.java │ │ ├── Role.java │ │ └── TypedCode.java │ │ ├── service │ │ └── PermissionService.java │ │ └── support │ │ ├── parser │ │ ├── RoleCodeParser.java │ │ ├── RoleParser.java │ │ └── SimpleRoleParser.java │ │ └── repository │ │ └── PermissionAwarePageImpl.java ├── resource │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── rbac │ │ ├── ResourceModuleConfiguration.java │ │ ├── exception │ │ ├── ResourceException.java │ │ └── ResourceNotFoundException.java │ │ ├── model │ │ ├── Action.java │ │ ├── DefaultAction.java │ │ ├── DefaultResource.java │ │ ├── DefaultResourceChild.java │ │ ├── MutableResource.java │ │ ├── MutableResourceChild.java │ │ ├── ParentAware.java │ │ ├── Resource.java │ │ ├── ResourceChild.java │ │ └── ResourceMatcher.java │ │ ├── repository │ │ ├── ResourceMemoryRepository.java │ │ └── ResourceRepository.java │ │ ├── service │ │ ├── DefaultResourceService.java │ │ └── ResourceService.java │ │ ├── spi │ │ └── ResourceProvider.java │ │ └── support │ │ └── matcher │ │ ├── ResourceAntPathMatcher.java │ │ └── ResourceMatchers.java ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── rbac │ │ ├── RbacMenuConfiguration.java │ │ ├── RbacMockModuleConfiguration.java │ │ ├── RbacRestModuleConfiguration.java │ │ └── rest │ │ ├── controller │ │ ├── PermissionRestController.java │ │ └── ResourceRestController.java │ │ ├── dto │ │ ├── GrantResourceParameter.java │ │ ├── PrivilegedAction.java │ │ ├── PrivilegedResource.java │ │ └── PrivilegedResourceWithChildren.java │ │ ├── service │ │ ├── ResourceCacheService.java │ │ └── impl │ │ │ └── ResourceCacheServiceMemoryImpl.java │ │ └── support │ │ ├── PermissionRestSupport.java │ │ ├── ResourceRestSupport.java │ │ ├── impl │ │ ├── PermissionRestSupportImpl.java │ │ └── ResourceRestSupportImpl.java │ │ └── mock │ │ ├── PermissionRestSupportMockImpl.java │ │ └── ResourceRestSupportMockImpl.java └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── sample ├── attachment │ ├── core │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── attachment │ │ │ ├── domain │ │ │ ├── model │ │ │ │ ├── Attachment.java │ │ │ │ ├── AttachmentCategory.java │ │ │ │ └── AttachmentDownloadHistory.java │ │ │ └── request │ │ │ │ ├── AttachmentQueryRequest.java │ │ │ │ ├── DownloadAttachmentEvent.java │ │ │ │ └── SaveAttachmentRequest.java │ │ │ ├── exception │ │ │ ├── AttachmentException.java │ │ │ └── AttachmentNotFoundException.java │ │ │ └── service │ │ │ └── AttachmentService.java │ ├── impl │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── attachment │ │ │ ├── AttachmentConfigurationProperties.java │ │ │ ├── AttachmentServiceModuleConfiguration.java │ │ │ ├── event │ │ │ ├── DownloadAttachmentEventListener.java │ │ │ └── DownloadAttachmentEventObject.java │ │ │ ├── repository │ │ │ ├── AttachmentCategoryRepository.java │ │ │ ├── AttachmentDownloadHistoryRepository.java │ │ │ ├── AttachmentRepository.java │ │ │ └── custom │ │ │ │ ├── AttachmentRepositoryCustom.java │ │ │ │ └── impl │ │ │ │ └── AttachmentRepositoryImpl.java │ │ │ └── service │ │ │ └── impl │ │ │ └── AttachmentServiceImpl.java │ ├── rest │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── attachment │ │ │ ├── AttachmentMenuConfiguration.java │ │ │ ├── AttachmentMockModuleConfiguration.java │ │ │ ├── AttachmentRestModuleConfiguration.java │ │ │ └── rest │ │ │ ├── controller │ │ │ └── AttachmentRestController.java │ │ │ ├── dto │ │ │ ├── AttachmentDetail.java │ │ │ ├── AttachmentQueryParameter.java │ │ │ ├── AttachmentSummary.java │ │ │ ├── DownloadSummary.java │ │ │ ├── PublishableSummary.java │ │ │ └── SaveAttachmentParameter.java │ │ │ └── support │ │ │ ├── AttachmentRestSupport.java │ │ │ ├── impl │ │ │ └── AttachmentRestSupportImpl.java │ │ │ └── mock │ │ │ └── AttachmentRestSupportMockImpl.java │ └── starter │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── spring.factories ├── news │ ├── core │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── news │ │ │ ├── domain │ │ │ ├── model │ │ │ │ ├── News.java │ │ │ │ ├── NewsCategory.java │ │ │ │ └── NewsReadHistory.java │ │ │ └── request │ │ │ │ ├── NewsQueryRequest.java │ │ │ │ ├── ReadNewsEvent.java │ │ │ │ └── SaveNewsRequest.java │ │ │ ├── exception │ │ │ ├── NewsAttachmentException.java │ │ │ ├── NewsException.java │ │ │ └── NewsNotFoundException.java │ │ │ └── service │ │ │ └── NewsService.java │ ├── impl │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── news │ │ │ ├── NewsConfigurationProperties.java │ │ │ ├── NewsServiceModuleConfiguration.java │ │ │ ├── repository │ │ │ ├── NewsCategoryRepository.java │ │ │ ├── NewsReadHistoryRepository.java │ │ │ ├── NewsRepository.java │ │ │ └── custom │ │ │ │ ├── NewsRepositoryCustom.java │ │ │ │ └── impl │ │ │ │ └── NewsRepositoryImpl.java │ │ │ └── service │ │ │ └── impl │ │ │ └── NewsServiceImpl.java │ ├── rest │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── news │ │ │ ├── NewsMenuConfiguration.java │ │ │ ├── NewsMockModuleConfiguration.java │ │ │ ├── NewsRestModuleConfiguration.java │ │ │ └── rest │ │ │ ├── controller │ │ │ └── NewsRestController.java │ │ │ ├── dto │ │ │ ├── NewsDetail.java │ │ │ ├── NewsQueryParameter.java │ │ │ ├── NewsSummary.java │ │ │ ├── PublishableSummary.java │ │ │ ├── ReadNewsEventObject.java │ │ │ ├── ReadSummary.java │ │ │ └── SaveNewsParameter.java │ │ │ └── support │ │ │ ├── NewsRestSupport.java │ │ │ ├── impl │ │ │ └── NewsRestSupportImpl.java │ │ │ └── mock │ │ │ └── NewsRestSupportMockImpl.java │ └── starter │ │ ├── build.gradle │ │ ├── gradle.properties │ │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── spring.factories └── setting │ ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── setting │ │ ├── domain │ │ ├── model │ │ │ └── SystemSetting.java │ │ └── request │ │ │ └── SaveSystemSettingRequest.java │ │ ├── exception │ │ └── SystemSettingException.java │ │ └── service │ │ └── SystemSettingService.java │ ├── impl │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── setting │ │ ├── SettingServiceModuleConfiguration.java │ │ ├── repository │ │ └── SystemSettingRepository.java │ │ └── service │ │ └── impl │ │ └── SystemSettingServiceImpl.java │ ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── setting │ │ ├── SettingConfigurationProperties.java │ │ ├── SettingInitializingBean.java │ │ ├── SystemSettingMenuConfiguration.java │ │ ├── SystemSettingMockModuleConfiguration.java │ │ ├── SystemSettingRestModuleConfiguration.java │ │ └── rest │ │ ├── controller │ │ └── SystemSettingRestController.java │ │ ├── dto │ │ ├── SaveSystemSettingParameter.java │ │ └── SystemSettingSummary.java │ │ └── support │ │ ├── SystemSettingRestSupport.java │ │ ├── impl │ │ └── SystemSettingRestSupportImpl.java │ │ └── mock │ │ └── SystemSettingRestSupportMockImpl.java │ └── starter │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── security ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── security │ │ ├── AuthenticationRequiredException.java │ │ ├── SecurityContext.java │ │ └── SecurityContexts.java ├── jwt │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── security │ │ │ ├── SecurityModuleConfiguration.java │ │ │ └── impl │ │ │ ├── audit │ │ │ └── SecurityContextAuditImpl.java │ │ │ ├── auth │ │ │ └── AuthEventHelper.java │ │ │ └── spring │ │ │ ├── SecurityContextImpl.java │ │ │ ├── UserDetails.java │ │ │ ├── UserDetailsAuthenticationProviderImpl.java │ │ │ ├── UserDetailsServiceImpl.java │ │ │ ├── mvc │ │ │ ├── AccessDeniedHandlerMvcImpl.java │ │ │ ├── AuthenticationEntryPointMvcImpl.java │ │ │ ├── AuthenticationFailureHandlerMvcImpl.java │ │ │ └── AuthenticationSuccessHandlerMvcImpl.java │ │ │ └── rest │ │ │ ├── AccessDeniedHandlerRestImpl.java │ │ │ ├── AuthenticationEntryPointRestImpl.java │ │ │ ├── AuthenticationFailureHandlerRestImpl.java │ │ │ ├── AuthenticationSuccessHandlerRestImpl.java │ │ │ └── LogoutSuccessHandlerRestImpl.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── in.clouthink.daas.sbb.audit.security.SecurityContext │ │ └── in.clouthink.daas.sbb.security.SecurityContext └── spring │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ ├── java │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── security │ │ ├── SecurityModuleConfiguration.java │ │ └── impl │ │ ├── audit │ │ ├── AuditEventPersisterImpl.java │ │ └── SecurityContextAuditImpl.java │ │ ├── auth │ │ └── AuthEventHelper.java │ │ └── spring │ │ ├── SecurityContextImpl.java │ │ ├── UserDetails.java │ │ ├── UserDetailsAuthenticationProviderImpl.java │ │ ├── UserDetailsServiceImpl.java │ │ ├── mvc │ │ ├── AccessDeniedHandlerMvcImpl.java │ │ ├── AuthenticationEntryPointMvcImpl.java │ │ ├── AuthenticationFailureHandlerMvcImpl.java │ │ └── AuthenticationSuccessHandlerMvcImpl.java │ │ └── rest │ │ ├── AccessDeniedHandlerRestImpl.java │ │ ├── AuthenticationEntryPointRestImpl.java │ │ ├── AuthenticationFailureHandlerRestImpl.java │ │ ├── AuthenticationSuccessHandlerRestImpl.java │ │ └── LogoutSuccessHandlerRestImpl.java │ └── resources │ └── META-INF │ └── services │ ├── in.clouthink.daas.sbb.audit.security.SecurityContext │ └── in.clouthink.daas.sbb.security.SecurityContext ├── settings.gradle ├── shared ├── build.gradle ├── gradle.properties └── src │ └── main │ └── java │ └── in │ └── clouthink │ └── daas │ └── sbb │ ├── exception │ └── BizException.java │ └── shared │ ├── DomainConstants.java │ ├── converter │ ├── BigDecimalToDoubleConverter.java │ └── DoubleToBigDecimalConverter.java │ ├── domain │ ├── model │ │ ├── BaseModel.java │ │ ├── DefaultPasswordEncoder.java │ │ ├── IntValueProvider.java │ │ ├── PasswordEncoder.java │ │ ├── PasswordSaltProvider.java │ │ ├── PublishableModel.java │ │ ├── StringIdentifier.java │ │ ├── StringValueProvider.java │ │ ├── ValueEnumSerializer.java │ │ └── ValueProvider.java │ └── request │ │ ├── AbstractQueryRequest.java │ │ ├── DateRangedQueryRequest.java │ │ ├── PageQueryRequest.java │ │ ├── PublishableQueryRequest.java │ │ └── impl │ │ ├── DateRangedQueryParameter.java │ │ ├── PageQueryParameter.java │ │ └── PublishableQueryParameter.java │ ├── repository │ ├── AbstractRepository.java │ ├── QueryBuilder.java │ └── custom │ │ ├── AbstractCustomRepository.java │ │ ├── RepositoryCustomHelper.java │ │ └── impl │ │ └── AbstractCustomRepositoryImpl.java │ ├── security │ └── algorithm │ │ ├── TOTP.java │ │ └── TOTPUtils.java │ └── util │ ├── DateTimeUtils.java │ ├── ErrorUtils.java │ ├── HmacUtils.java │ ├── I18nUtils.java │ ├── IOUtils.java │ ├── ImageUtils.java │ ├── JsonUtils.java │ ├── KeyUtils.java │ ├── SecurityUtils.java │ ├── ShortenUrlUtils.java │ ├── UserAgentUtils.java │ ├── ValidationException.java │ ├── ValidationUtils.java │ ├── WebUtils.java │ └── impl │ ├── BaiduShortUrlGenerator.java │ ├── DefaultShortUrlGenerator.java │ ├── ShortUrlGenerator.java │ └── SinaShortUrlGenerator.java ├── storage ├── README.md ├── alioss │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── storage │ │ └── alioss │ │ ├── AliOssDownloadUrlProvider.java │ │ ├── AliossConfigureProperties.java │ │ └── AliossModuleConfiguration.java ├── core │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── storage │ │ ├── exception │ │ ├── FileException.java │ │ └── FileNotFoundException.java │ │ └── spi │ │ └── DownloadUrlProvider.java ├── gridfs │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── storage │ │ ├── GridfsConfigureProperties.java │ │ ├── GridfsModuleConfiguration.java │ │ └── gridfs │ │ └── GridfsDownloadUrlProvider.java ├── localfs │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── java │ │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── storage │ │ ├── LocalfsConfigureProperties.java │ │ ├── LocalfsModuleConfiguration.java │ │ └── local │ │ └── LocalfsDownloadUrlProvider.java ├── rest │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── storage │ │ │ ├── StorageMockModuleConfiguration.java │ │ │ ├── StorageModuleConfiguration.java │ │ │ ├── controller │ │ │ └── AdvancedFileObjectRestController.java │ │ │ ├── dto │ │ │ └── DefaultFileObjectQueryParameter.java │ │ │ └── support │ │ │ ├── AdvancedFileObjectQueryRestSupport.java │ │ │ ├── impl │ │ │ └── AdvancedFileObjectQueryRestSupportImpl.java │ │ │ └── mock │ │ │ └── AdvancedFileObjectQueryRestSupportMockImpl.java │ │ └── resources │ │ └── META-INF │ │ └── spring.factories └── starter │ ├── build.gradle │ └── gradle.properties ├── support ├── cors │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── support │ │ │ └── cors │ │ │ ├── CorsSupportConfiguration.java │ │ │ └── CorsSupportProperties.java │ │ └── resources │ │ └── META-INF │ │ └── spring.factories ├── security │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── support │ │ │ └── security │ │ │ └── OpenApiSecurityConfigurer.java │ │ └── resources │ │ └── META-INF │ │ └── spring.factories ├── session │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── in │ │ │ └── clouthink │ │ │ └── daas │ │ │ └── sbb │ │ │ └── support │ │ │ └── session │ │ │ └── SpringSessionConfiguration.java │ │ └── resources │ │ └── META-INF │ │ └── spring.factories └── webhook │ ├── build.gradle │ ├── gradle.properties │ └── src │ └── main │ ├── java │ └── in │ │ └── clouthink │ │ └── daas │ │ └── sbb │ │ └── support │ │ └── webhook │ │ ├── WebHookSupportConfiguration.java │ │ ├── WebHookSupportProperties.java │ │ ├── client │ │ ├── WebHookClient.java │ │ └── impl │ │ │ ├── BearyChatMessage.java │ │ │ ├── BearyChatMessageAttachment.java │ │ │ └── WebHookClientBearyChatImpl.java │ │ └── notify │ │ ├── AbstractNotification.java │ │ ├── ShutdownNotification.java │ │ └── StartupNotification.java │ └── resources │ └── META-INF │ └── spring.factories └── toolkit └── paw └── default.paw /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | build/ 3 | .gradle 4 | .DS_Store 5 | .idea 6 | *.iml 7 | *.iws 8 | *.log -------------------------------------------------------------------------------- /account/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | } -------------------------------------------------------------------------------- /account/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=account-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/model/Gender.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.model; 2 | 3 | /** 4 | * 性别 5 | */ 6 | public enum Gender { 7 | 8 | //男 9 | MALE, 10 | //女 11 | FEMALE 12 | 13 | } 14 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/model/PasswordSaltProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface PasswordSaltProvider { 7 | 8 | String getSalt(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/model/RoleType.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.model; 2 | 3 | /** 4 | * The role type def. 5 | * 6 | * @author dz 7 | */ 8 | public enum RoleType { 9 | 10 | //系统角色(系统内置角色,不可修改,如果是spring security默认实现,则以ROLE_作为前缀) 11 | SYS_ROLE, 12 | 13 | //应用角色(应用扩展角色,用户可自定义,是否需要前缀由provider决定) 14 | APP_ROLE 15 | 16 | } 17 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/model/SysRole.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.model; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | 5 | /** 6 | * 系统内置角色 7 | */ 8 | public enum SysRole implements GrantedAuthority { 9 | 10 | // 系统 - 普通用户 11 | ROLE_USER("普通用户") { 12 | @Override 13 | public String getAuthority() { 14 | return "ROLE_USER"; 15 | } 16 | }, 17 | // 系统 - 管理员 18 | ROLE_MGR("管理员") { 19 | @Override 20 | public String getAuthority() { 21 | return "ROLE_MGR"; 22 | } 23 | }, 24 | // 系统 - 超级管理员 25 | ROLE_ADMIN("超级管理员") { 26 | @Override 27 | public String getAuthority() { 28 | return "ROLE_ADMIN"; 29 | } 30 | }; 31 | 32 | private final String displayName; 33 | 34 | SysRole(String value) { 35 | displayName = value; 36 | } 37 | 38 | public String getCode() { 39 | return name(); 40 | } 41 | 42 | public String getDisplayName() { 43 | return displayName; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/AbstractUserRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | /** 4 | */ 5 | public interface AbstractUserRequest { 6 | 7 | String getCellphone(); 8 | 9 | String getEmail(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/ChangeUserProfileRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.Gender; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | */ 9 | public interface ChangeUserProfileRequest extends AbstractUserRequest { 10 | 11 | String getDisplayName(); 12 | 13 | Gender getGender(); 14 | 15 | Date getBirthday(); 16 | 17 | String getProvince(); 18 | 19 | String getCity(); 20 | 21 | String getSignature(); 22 | } 23 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/RoleQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.PageQueryRequest; 4 | 5 | public interface RoleQueryRequest extends PageQueryRequest { 6 | } 7 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/SaveImageRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | /** 4 | */ 5 | public interface SaveImageRequest { 6 | 7 | String getId(); 8 | 9 | String getUrl(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/SaveRoleRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | public interface SaveRoleRequest { 4 | 5 | /** 6 | * Always return the upper cased code , and the code must be unique 7 | * @return 8 | */ 9 | String getCode(); 10 | 11 | String getName(); 12 | 13 | String getDescription(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/SaveUserRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.Gender; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | */ 9 | public interface SaveUserRequest extends AbstractUserRequest { 10 | 11 | String getUsername(); 12 | 13 | String getCellphone(); 14 | 15 | Gender getGender(); 16 | 17 | String getAvatarId(); 18 | 19 | Date getBirthday(); 20 | 21 | String getPassword(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/UserQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.Gender; 5 | 6 | public interface UserQueryRequest extends UsernameQueryRequest { 7 | 8 | /** 9 | * @return 联系电话 10 | */ 11 | String getCellphone(); 12 | 13 | /** 14 | * @return 电子邮箱 15 | */ 16 | String getEmail(); 17 | 18 | /** 19 | * @return 是否启用(或禁用) 20 | */ 21 | Boolean getEnabled(); 22 | 23 | /** 24 | * @return 显示的用户名 25 | */ 26 | String getDisplayName(); 27 | 28 | /** 29 | * @return 性别 30 | */ 31 | Gender getGender(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/UsernameQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | 4 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 5 | 6 | public interface UsernameQueryRequest extends DateRangedQueryRequest { 7 | 8 | /** 9 | * 用户名 10 | * 11 | * @return 12 | */ 13 | String getUsername(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/domain/request/UsersForRoleRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.domain.request; 2 | 3 | import java.util.List; 4 | 5 | public interface UsersForRoleRequest { 6 | 7 | List getUserIds(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/PasscodeException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public class PasscodeException extends BizException { 9 | 10 | public PasscodeException() { 11 | } 12 | 13 | public PasscodeException(String message) { 14 | super(message); 15 | } 16 | 17 | public PasscodeException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public PasscodeException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public PasscodeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/RegisterException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | */ 7 | public class RegisterException extends BizException { 8 | 9 | public RegisterException() { 10 | } 11 | 12 | public RegisterException(String message) { 13 | super(message); 14 | } 15 | 16 | public RegisterException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public RegisterException(Throwable cause) { 21 | super(cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/RoleException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | * 7 | */ 8 | public class RoleException extends BizException { 9 | 10 | public RoleException() { 11 | } 12 | 13 | public RoleException(String message) { 14 | super(message); 15 | } 16 | 17 | public RoleException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public RoleException(Throwable cause) { 22 | super(cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/RoleNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | 4 | /** 5 | * 6 | */ 7 | public class RoleNotFoundException extends RoleException { 8 | 9 | public RoleNotFoundException() { 10 | } 11 | 12 | public RoleNotFoundException(String message) { 13 | super(message); 14 | } 15 | 16 | public RoleNotFoundException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public RoleNotFoundException(Throwable cause) { 21 | super(cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/UserException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | * 7 | */ 8 | public class UserException extends BizException { 9 | 10 | public UserException() { 11 | } 12 | 13 | public UserException(String message) { 14 | super(message); 15 | } 16 | 17 | public UserException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public UserException(Throwable cause) { 22 | super(cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/UserNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | /** 4 | * 5 | */ 6 | public class UserNotFoundException extends UserException { 7 | 8 | public UserNotFoundException() { 9 | } 10 | 11 | public UserNotFoundException(String message) { 12 | super(message); 13 | } 14 | 15 | public UserNotFoundException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public UserNotFoundException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/UserPasswordException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | /** 4 | * 5 | */ 6 | public class UserPasswordException extends UserException { 7 | 8 | public UserPasswordException() { 9 | } 10 | 11 | public UserPasswordException(String message) { 12 | super(message); 13 | } 14 | 15 | public UserPasswordException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public UserPasswordException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/exception/UserRequiredException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.exception; 2 | 3 | import in.clouthink.daas.security.token.exception.AuthenticationRequiredException; 4 | 5 | /** 6 | * 7 | */ 8 | public class UserRequiredException extends AuthenticationRequiredException { 9 | 10 | public UserRequiredException() { 11 | } 12 | 13 | public UserRequiredException(String message) { 14 | super(message); 15 | } 16 | 17 | public UserRequiredException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public UserRequiredException(Throwable cause) { 22 | super(cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/service/UserProfileService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.service; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.account.domain.request.ChangeUserProfileRequest; 5 | 6 | /** 7 | */ 8 | public interface UserProfileService { 9 | 10 | /** 11 | * @param userId 12 | * @return 13 | */ 14 | User findUserById(String userId); 15 | 16 | 17 | /** 18 | * @param userId 19 | * @param request 20 | * @return 21 | */ 22 | User changeUserProfile(String userId, ChangeUserProfileRequest request); 23 | 24 | /** 25 | * @param userId 26 | * @param oldPassword 27 | * @param newPassword 28 | * @return 29 | */ 30 | User changeUserPassword(String userId, String oldPassword, String newPassword); 31 | 32 | /** 33 | * @param id 34 | * @param url 35 | * @param byWho 36 | */ 37 | void updateUserAvatar(String id, String url, User byWho); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/spi/AppRoleReference.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.spi; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.AppRole; 4 | 5 | /** 6 | * The AppRole Refz check, if refz found, the AppRole can not be deleted 7 | * 8 | * @author dz 9 | */ 10 | public interface AppRoleReference { 11 | 12 | /** 13 | * @param target 14 | * @return 15 | */ 16 | boolean hasReference(AppRole target); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /account/core/src/main/java/in/clouthink/daas/sbb/account/spi/UserReference.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.spi; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | 5 | /** 6 | * The User Refz check, if refz found, the User can not be deleted 7 | * 8 | * @author dz 9 | */ 10 | public interface UserReference { 11 | 12 | /** 13 | * @param target 14 | * @return 15 | */ 16 | boolean hasReference(User target); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /account/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':account/core') 8 | 9 | } -------------------------------------------------------------------------------- /account/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=account-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/AccountPasswordConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.PasswordSaltProvider; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.account.password") 7 | public class AccountPasswordConfigurationProperties implements PasswordSaltProvider { 8 | 9 | private String salt = "@account.sbb.daas.clouthink.in"; 10 | 11 | public String getSalt() { 12 | return salt; 13 | } 14 | 15 | public void setSalt(String salt) { 16 | this.salt = salt; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/AccountServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.account.service", "in.clouthink.daas.sbb.account.repository"}) 10 | @EnableMongoRepositories({"in.clouthink.daas.sbb.account.repository"}) 11 | @EnableConfigurationProperties(AccountPasswordConfigurationProperties.class) 12 | public class AccountServiceModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/repository/AppRoleRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.AppRole; 4 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | 10 | public interface AppRoleRepository extends AbstractRepository { 11 | 12 | AppRole findByCode(String code); 13 | 14 | AppRole findByName(String name); 15 | 16 | } -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.account.repository.custom.UserRepositoryCustom; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface UserRepository extends AbstractRepository, UserRepositoryCustom { 11 | 12 | User findByUsername(String username); 13 | 14 | User findByCellphone(String cellphone); 15 | 16 | User findByEmail(String email); 17 | 18 | } -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/repository/UserRoleRelationshipRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.AppRole; 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.account.domain.model.UserRoleRelationship; 6 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | 10 | import java.util.List; 11 | 12 | 13 | /** 14 | * @author dz 15 | */ 16 | public interface UserRoleRelationshipRepository extends AbstractRepository { 17 | 18 | Page findByRole(AppRole role, Pageable pageable); 19 | 20 | Page findByUser(User user, Pageable pageable); 21 | 22 | List findListByUser(User user); 23 | 24 | UserRoleRelationship findByUserAndRole(User user, AppRole role); 25 | 26 | UserRoleRelationship findFirstByRole(AppRole appRole); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /account/impl/src/main/java/in/clouthink/daas/sbb/account/repository/custom/UserRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.SysRole; 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.account.domain.request.UserQueryRequest; 6 | import in.clouthink.daas.sbb.account.domain.request.UsernameQueryRequest; 7 | import org.springframework.data.domain.Page; 8 | 9 | /** 10 | * 系统用户持久层扩展 11 | * 12 | * @author dz 13 | */ 14 | public interface UserRepositoryCustom { 15 | 16 | Page queryPage(UsernameQueryRequest queryRequest); 17 | 18 | Page queryPage(SysRole role, UserQueryRequest queryRequest); 19 | 20 | Page queryPage(UserQueryRequest queryRequest); 21 | 22 | Page queryArchivedUsers(UserQueryRequest queryRequest); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /account/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':storage/core') 8 | compile project(':account/core') 9 | compile project(':account/impl') 10 | compile project(':security/core') 11 | compile project(':menu/core') 12 | 13 | } -------------------------------------------------------------------------------- /account/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=account-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/AccountMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.account.rest.controller", "in.clouthink.daas.sbb.account.rest.support.mock"}) 8 | public class AccountMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/AvatarSummary.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | @ApiModel("用户头像") 7 | public class AvatarSummary { 8 | 9 | @ApiModelProperty("头像对应的图片存储的id") 10 | private String id; 11 | 12 | @ApiModelProperty("头像对应的图片链接的url") 13 | private String url; 14 | 15 | public String getId() { 16 | return id; 17 | } 18 | 19 | public void setId(String id) { 20 | this.id = id; 21 | } 22 | 23 | public String getUrl() { 24 | return url; 25 | } 26 | 27 | public void setUrl(String url) { 28 | this.url = url; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/Cellphone.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | @JsonIgnoreProperties(ignoreUnknown = true) 7 | @ApiModel("电话号码") 8 | public class Cellphone { 9 | 10 | private String cellphone; 11 | 12 | public String getCellphone() { 13 | return cellphone; 14 | } 15 | 16 | public void setCellphone(String cellphone) { 17 | this.cellphone = cellphone; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/ChangeMyPasswordRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | /** 7 | * 8 | */ 9 | @JsonIgnoreProperties(ignoreUnknown = true) 10 | @ApiModel("修改当前用户密码") 11 | public class ChangeMyPasswordRequest { 12 | 13 | private String oldPassword; 14 | 15 | private String newPassword; 16 | 17 | public String getOldPassword() { 18 | return oldPassword; 19 | } 20 | 21 | public void setOldPassword(String oldPassword) { 22 | this.oldPassword = oldPassword; 23 | } 24 | 25 | public String getNewPassword() { 26 | return newPassword; 27 | } 28 | 29 | public void setNewPassword(String newPassword) { 30 | this.newPassword = newPassword; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/ChangePasswordRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | @JsonIgnoreProperties(ignoreUnknown = true) 7 | @ApiModel("修改用户密码") 8 | public class ChangePasswordRequest { 9 | 10 | private String userId; 11 | 12 | private String newPassword; 13 | 14 | public String getUserId() { 15 | return userId; 16 | } 17 | 18 | public void setUserId(String userId) { 19 | this.userId = userId; 20 | } 21 | 22 | public String getNewPassword() { 23 | return newPassword; 24 | } 25 | 26 | public void setNewPassword(String newPassword) { 27 | this.newPassword = newPassword; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/RoleQueryParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import in.clouthink.daas.sbb.account.domain.request.RoleQueryRequest; 4 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 5 | import io.swagger.annotations.ApiModel; 6 | 7 | @ApiModel("角色查询参数") 8 | public class RoleQueryParameter extends PageQueryParameter implements RoleQueryRequest { 9 | } 10 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/SaveImageParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import in.clouthink.daas.sbb.account.domain.request.SaveImageRequest; 5 | import io.swagger.annotations.ApiModel; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown = true) 8 | @ApiModel("保存图片申请") 9 | public class SaveImageParameter implements SaveImageRequest { 10 | 11 | private String id; 12 | 13 | private String url; 14 | 15 | @Override 16 | public String getId() { 17 | return id; 18 | } 19 | 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | 24 | @Override 25 | public String getUrl() { 26 | return url; 27 | } 28 | 29 | public void setUrl(String url) { 30 | this.url = url; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/SaveSortParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | @JsonIgnoreProperties(ignoreUnknown = true) 7 | @ApiModel("保存排序申请") 8 | public class SaveSortParameter { 9 | 10 | private String sorting; 11 | 12 | public String getSorting() { 13 | return sorting; 14 | } 15 | 16 | public void setSorting(String sorting) { 17 | this.sorting = sorting; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/UserProfile.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | @ApiModel("用户基本资料") 7 | public class UserProfile extends UserSummary { 8 | 9 | public static UserProfile from(User user) { 10 | if (user == null) { 11 | return null; 12 | } 13 | UserProfile result = new UserProfile(); 14 | convert(user, result); 15 | return result; 16 | } 17 | 18 | //TODO add roles 19 | 20 | } 21 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/UsernamePageQueryParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import in.clouthink.daas.sbb.account.domain.request.UsernameQueryRequest; 4 | import in.clouthink.daas.sbb.shared.domain.request.impl.DateRangedQueryParameter; 5 | import io.swagger.annotations.ApiModel; 6 | 7 | @ApiModel("按用户名查询申请") 8 | public class UsernamePageQueryParameter extends DateRangedQueryParameter implements UsernameQueryRequest { 9 | 10 | private String username; 11 | 12 | @Override 13 | public String getUsername() { 14 | return username; 15 | } 16 | 17 | public void setUsername(String username) { 18 | this.username = username; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/dto/UsersForRoleParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import in.clouthink.daas.sbb.account.domain.request.UsersForRoleRequest; 5 | import io.swagger.annotations.ApiModel; 6 | 7 | import java.util.List; 8 | 9 | @JsonIgnoreProperties(ignoreUnknown = true) 10 | @ApiModel("角色和用户绑定申请") 11 | public class UsersForRoleParameter implements UsersForRoleRequest { 12 | 13 | private List userIds; 14 | 15 | @Override 16 | public List getUserIds() { 17 | return userIds; 18 | } 19 | 20 | public void setUserIds(List userIds) { 21 | this.userIds = userIds; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/support/ArchivedUserRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.rest.dto.UserDetail; 4 | import in.clouthink.daas.sbb.account.rest.dto.UserQueryParameter; 5 | import in.clouthink.daas.sbb.account.rest.dto.UserSummary; 6 | import org.springframework.data.domain.Page; 7 | 8 | /** 9 | */ 10 | public interface ArchivedUserRestSupport { 11 | 12 | Page listArchivedUsers(UserQueryParameter queryRequest); 13 | 14 | UserDetail getArchivedUser(String id); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/support/UserProfileRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.account.rest.dto.ChangeMyPasswordRequest; 5 | import in.clouthink.daas.sbb.account.rest.dto.ChangeMyProfileParameter; 6 | import in.clouthink.daas.sbb.account.rest.dto.UserProfile; 7 | 8 | /** 9 | * 10 | */ 11 | public interface UserProfileRestSupport { 12 | 13 | /** 14 | * 15 | * @param byWho 16 | * @return 17 | */ 18 | UserProfile getUserProfile(User byWho); 19 | 20 | /** 21 | * 22 | * @param request 23 | * @param byWho 24 | */ 25 | void updateUserProfile(ChangeMyProfileParameter request, User byWho); 26 | 27 | /** 28 | * 29 | * @param request 30 | * @param byWho 31 | */ 32 | void changeMyPassword(ChangeMyPasswordRequest request, User byWho); 33 | 34 | /** 35 | * 更新用户头像 36 | * 37 | * @param imageId 如果为空,则清空用户头像 38 | * @param byWho 39 | */ 40 | void updateUserAvatar(String imageId, User byWho); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/support/UserRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.account.rest.dto.*; 5 | import org.springframework.data.domain.Page; 6 | 7 | /** 8 | * 9 | */ 10 | public interface UserRestSupport { 11 | 12 | Page listUsers(UserQueryParameter queryRequest); 13 | 14 | UserDetail getUserDetail(String id); 15 | 16 | User createUser(SaveUserParameter request); 17 | 18 | void updateUser(String id, SaveUserParameter request); 19 | 20 | void deleteUser(String id, User byWho); 21 | 22 | void changePassword(String id, ChangePasswordRequest request); 23 | 24 | void enableUser(String id); 25 | 26 | void disableUser(String id); 27 | 28 | void lockUser(String id); 29 | 30 | void unlockUser(String id); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /account/rest/src/main/java/in/clouthink/daas/sbb/account/rest/support/mock/ArchivedUserRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.account.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.account.rest.dto.UserDetail; 4 | import in.clouthink.daas.sbb.account.rest.dto.UserQueryParameter; 5 | import in.clouthink.daas.sbb.account.rest.dto.UserSummary; 6 | import in.clouthink.daas.sbb.account.rest.support.ArchivedUserRestSupport; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * ArchivedUserRestSupport mocker 12 | * 13 | * @author dz 14 | */ 15 | @Component 16 | public class ArchivedUserRestSupportMockImpl implements ArchivedUserRestSupport { 17 | 18 | @Override 19 | public Page listArchivedUsers(UserQueryParameter queryRequest) { 20 | return null; 21 | } 22 | 23 | @Override 24 | public UserDetail getArchivedUser(String id) { 25 | return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /account/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':account/core') 3 | compile project(':account/impl') 4 | compile project(':account/rest') 5 | } -------------------------------------------------------------------------------- /account/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=account-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /account/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.account.AccountRestModuleConfiguration -------------------------------------------------------------------------------- /audit/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.springSecurity 5 | compile libs.springThymeleaf 6 | compile libs.springBootTomcat 7 | compile libs.daas 8 | 9 | compile project(':shared') 10 | compile project(':account/core') 11 | 12 | } 13 | -------------------------------------------------------------------------------- /audit/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=audit-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/AuditServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.audit.event", 9 | "in.clouthink.daas.sbb.audit.service", 10 | "in.clouthink.daas.sbb.audit.repository"}) 11 | @EnableMongoRepositories({"in.clouthink.daas.sbb.audit.repository"}) 12 | public class AuditServiceModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/domain/model/AggregationType.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.domain.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public enum AggregationType { 7 | 8 | MONTH, DAY 9 | 10 | } 11 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/domain/request/AuditEventQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.domain.request; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public interface AuditEventQueryRequest extends DateRangedQueryRequest { 9 | 10 | /** 11 | * @return never null 12 | */ 13 | String getRealm(); 14 | 15 | /** 16 | * @return who send the request 17 | */ 18 | String getRequestedBy(); 19 | 20 | /** 21 | * @return 22 | */ 23 | String getRequestedUrl(); 24 | 25 | /** 26 | * @return 27 | */ 28 | Boolean getError(); 29 | 30 | /** 31 | * @return 32 | */ 33 | String getClientAddress(); 34 | 35 | /** 36 | * @return 37 | */ 38 | String getServiceName(); 39 | 40 | /** 41 | * @return 42 | */ 43 | String getMethodName(); 44 | 45 | /** 46 | * @return 47 | */ 48 | Long getTimeCost(); 49 | 50 | } 51 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/domain/request/AuthEventQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.domain.request; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public interface AuthEventQueryRequest extends DateRangedQueryRequest { 9 | 10 | /** 11 | * @return never null 12 | */ 13 | String getRealm(); 14 | 15 | /** 16 | * @return who request the authentication 17 | */ 18 | String getUsername(); 19 | 20 | /** 21 | * @return 22 | */ 23 | Boolean getSucceed(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/event/RemoveEventConstants.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.event; 2 | 3 | /** 4 | */ 5 | public interface RemoveEventConstants { 6 | 7 | String DELETE_AUDIT_EVENT_BEFORE_DAY = "DELETE_AUDIT_EVENT_BEFORE_DAY"; 8 | 9 | String DELETE_AUTH_EVENT_BEFORE_DAY = "DELETE_AUTH_EVENT_BEFORE_DAY"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/event/RemoveEventObject.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.event; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | /** 7 | * remove audit(auth) event before specified day 8 | */ 9 | public class RemoveEventObject implements Serializable { 10 | 11 | private String realm; 12 | 13 | private Date beforeDay; 14 | 15 | public RemoveEventObject() { 16 | } 17 | 18 | public RemoveEventObject(String realm, Date beforeDay) { 19 | this.realm = realm; 20 | this.beforeDay = beforeDay; 21 | } 22 | 23 | public String getRealm() { 24 | return realm; 25 | } 26 | 27 | public void setRealm(String realm) { 28 | this.realm = realm; 29 | } 30 | 31 | public Date getBeforeDay() { 32 | return beforeDay; 33 | } 34 | 35 | public void setBeforeDay(Date beforeDay) { 36 | this.beforeDay = beforeDay; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/exception/AuditEventException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.exception; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class AuditEventException extends RuntimeException { 7 | 8 | public AuditEventException() { 9 | } 10 | 11 | public AuditEventException(String message) { 12 | super(message); 13 | } 14 | 15 | public AuditEventException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public AuditEventException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/exception/AuthEventException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.exception; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class AuthEventException extends RuntimeException { 7 | 8 | public AuthEventException() { 9 | } 10 | 11 | public AuthEventException(String message) { 12 | super(message); 13 | } 14 | 15 | public AuthEventException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public AuthEventException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/repository/AuditEventRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.repository; 2 | 3 | 4 | import in.clouthink.daas.sbb.audit.domain.model.AuditEvent; 5 | import in.clouthink.daas.sbb.audit.repository.custom.AuditEventRepositoryCustom; 6 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | public interface AuditEventRepository extends AbstractRepository, AuditEventRepositoryCustom { 12 | 13 | List findListByRequestedAtBetween(Date from, Date to); 14 | 15 | long deleteByRealmAndRequestedAtBetween(String realm, Date from, Date to); 16 | 17 | long deleteByRealmAndRequestedAtBefore(String realm, Date day); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/repository/AuthEventRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.repository; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuthEvent; 4 | import in.clouthink.daas.sbb.audit.repository.custom.AuthEventRepositoryCustom; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface AuthEventRepository extends AbstractRepository, AuthEventRepositoryCustom { 11 | 12 | List findListByLoginAtBetween(Date from, Date to); 13 | 14 | long deleteByRealmAndLoginAtBetween(String realm, Date from, Date to); 15 | 16 | long deleteByRealmAndLoginAtBefore(String realm, Date day); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/repository/custom/AuditEventRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuditEvent; 4 | import in.clouthink.daas.sbb.audit.domain.request.AuditEventQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | public interface AuditEventRepositoryCustom { 8 | 9 | Page queryPage(AuditEventQueryRequest queryRequest); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/repository/custom/AuthEventRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuthEvent; 4 | import in.clouthink.daas.sbb.audit.domain.request.AuthEventQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | /** 8 | */ 9 | public interface AuthEventRepositoryCustom { 10 | 11 | Page queryPage(AuthEventQueryRequest queryRequest); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/service/AuditEventService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.service; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuditEvent; 4 | import in.clouthink.daas.sbb.audit.domain.request.AuditEventQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | */ 11 | public interface AuditEventService { 12 | 13 | Page findAuditEventPage(AuditEventQueryRequest queryRequest); 14 | 15 | AuditEvent findById(String id); 16 | 17 | void deleteAuditEventsByDay(String realm, Date day); 18 | 19 | void deleteAuditEventsBeforeDay(String realm, Date day); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/service/AuditEventStatisticsService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.service; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import org.springframework.scheduling.annotation.Async; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * the statistics service for audit event 10 | */ 11 | public interface AuditEventStatisticsService { 12 | 13 | /** 14 | * 以天为单位统计数据 15 | * 16 | * @param realm 17 | * @param day 18 | */ 19 | void statisticByDay(String realm, Date day); 20 | 21 | /** 22 | * 以月为单位统计数据 23 | * 24 | * @param realm 25 | * @param day 26 | */ 27 | void statisticByMonth(String realm, Date day); 28 | 29 | /** 30 | * 统计所有的审计数据 31 | * 32 | * @param realm 33 | * @param byWho 34 | */ 35 | @Async 36 | void scanAllAuditEventsAndDoStatistics(String realm, User byWho); 37 | } 38 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/service/AuthEventService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.service; 2 | 3 | 4 | import in.clouthink.daas.sbb.audit.domain.model.AuthEvent; 5 | import in.clouthink.daas.sbb.audit.domain.request.AuthEventQueryRequest; 6 | import org.springframework.data.domain.Page; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * the auth(login) event service 12 | */ 13 | public interface AuthEventService { 14 | 15 | Page listUserAuthEvents(AuthEventQueryRequest queryParameter); 16 | 17 | AuthEvent findUserAuthEventById(String id); 18 | 19 | AuthEvent saveUserAuthEvent(AuthEvent authEvent); 20 | 21 | void deleteAuthEventsByDay(String realm, Date day); 22 | 23 | void deleteAuthEventsBeforeDay(String realm, Date day); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /audit/impl/src/main/java/in/clouthink/daas/sbb/audit/service/AuthEventStatisticsService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.service; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import org.springframework.scheduling.annotation.Async; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * The statistics service for auth event 10 | */ 11 | public interface AuthEventStatisticsService { 12 | 13 | /** 14 | * 以天为单位统计数据 15 | * 16 | * @param realm 17 | * @param day 18 | */ 19 | void statisticByDay(String realm, Date day); 20 | 21 | /** 22 | * 以月为单位统计数据 23 | * 24 | * @param realm 25 | * @param day 26 | */ 27 | void statisticByMonth(String realm, Date day); 28 | 29 | /** 30 | * 统计所有的审计数据 31 | * 32 | * @param realm 33 | * @param byWho 34 | */ 35 | @Async 36 | void scanAllAuthEventsAndDoStatistics(String realm, User byWho); 37 | } 38 | -------------------------------------------------------------------------------- /audit/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':audit/impl') 8 | compile project(':security/core') 9 | compile project(':menu/core') 10 | 11 | } -------------------------------------------------------------------------------- /audit/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=audit-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/AuditMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.audit.rest.controller", "in.clouthink.daas.sbb.audit.rest.support.mock"}) 8 | public class AuditMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/AuditRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.audit.rest.controller", "in.clouthink.daas.sbb.audit.rest.support.impl"}) 9 | @Import({AuditServiceModuleConfiguration.class, AuditMenuConfiguration.class}) 10 | public class AuditRestModuleConfiguration { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/AuditEventRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.audit.domain.model.AuditEvent; 5 | import in.clouthink.daas.sbb.audit.rest.dto.AuditEventQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | */ 12 | public interface AuditEventRestSupport { 13 | 14 | Page listAuditEventPage(AuditEventQueryParameter queryRequest); 15 | 16 | AuditEvent getAuditEventDetail(String id); 17 | 18 | void deleteAuditEventsByDay(String realm, Date day, User user); 19 | 20 | void deleteAuditEventsBeforeDay(String realm, Date day, User user); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/AuditReportRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuditEventAggregation; 4 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 5 | import org.springframework.data.domain.Page; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface AuditReportRestSupport { 11 | 12 | Page listAuditReportByMonth(String realm, PageQueryParameter queryParameter); 13 | 14 | Page listAuditReportByDay(String realm, PageQueryParameter queryParameter); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/AuthEventRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.audit.domain.model.AuthEvent; 5 | import in.clouthink.daas.sbb.audit.rest.dto.AuthEventQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | */ 12 | public interface AuthEventRestSupport { 13 | 14 | Page listAuthEventPage(AuthEventQueryParameter queryRequest); 15 | 16 | AuthEvent getAuthEventDetail(String id); 17 | 18 | void deleteAuthEventsByDay(String realm, Date day, User user); 19 | 20 | void deleteAuthEventsBeforeDay(String realm, Date day, User user); 21 | } 22 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/AuthReportRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuthEventAggregation; 4 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 5 | import org.springframework.data.domain.Page; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface AuthReportRestSupport { 11 | 12 | Page listAuthReportByMonth(String realm, PageQueryParameter queryRequest); 13 | 14 | Page listAuthReportByDay(String realm, PageQueryParameter queryRequest); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/mock/AuditReportRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuditEventAggregation; 4 | import in.clouthink.daas.sbb.audit.rest.support.AuditReportRestSupport; 5 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * AuditReportRestSupport mocker 11 | * 12 | * @author dz 13 | */ 14 | @Component 15 | public class AuditReportRestSupportMockImpl implements AuditReportRestSupport { 16 | @Override 17 | public Page listAuditReportByMonth(String realm, PageQueryParameter queryParameter) { 18 | return null; 19 | } 20 | 21 | @Override 22 | public Page listAuditReportByDay(String realm, PageQueryParameter queryParameter) { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /audit/rest/src/main/java/in/clouthink/daas/sbb/audit/rest/support/mock/AuthReportRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.audit.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.audit.domain.model.AuthEventAggregation; 4 | import in.clouthink.daas.sbb.audit.rest.support.AuthReportRestSupport; 5 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * AuthReportRestSupport mocker 11 | * 12 | * @author dz 13 | */ 14 | @Component 15 | public class AuthReportRestSupportMockImpl implements AuthReportRestSupport { 16 | @Override 17 | public Page listAuthReportByMonth(String realm, PageQueryParameter queryRequest) { 18 | return null; 19 | } 20 | 21 | @Override 22 | public Page listAuthReportByDay(String realm, PageQueryParameter queryRequest) { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /audit/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':audit/impl') 3 | compile project(':audit/rest') 4 | } -------------------------------------------------------------------------------- /audit/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=audit-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /audit/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.audit.AuditRestModuleConfiguration -------------------------------------------------------------------------------- /cloud/.env: -------------------------------------------------------------------------------- 1 | DEVOPS_HOST=192.168.31.42 2 | EUREKA_SERVICE_URL=http://192.168.31.42:8761/eureka/ 3 | MONGODB_HOST=mongodb 4 | MONGODB_PORT=27017 5 | REDIS_HOST=redis 6 | REDIS_PORT=6379 -------------------------------------------------------------------------------- /cloud/eureka/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=openapi-eureka 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /cloud/eureka/src/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | from clouthinkin/jre 2 | 3 | ADD build/libs/openapi-eureka-1.0.0-SNAPSHOT.jar / 4 | ADD docker/container_files/ / 5 | 6 | RUN chmod +x /*.sh 7 | 8 | EXPOSE 8080 9 | EXPOSE 8090 10 | WORKDIR / 11 | ENTRYPOINT /docker-entrypoint.sh 12 | -------------------------------------------------------------------------------- /cloud/eureka/src/docker/container_files/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # start service accordingly 4 | JAR_VERSION=1.0.0-SNAPSHOT 5 | 6 | echo "Using JAVA_OPTS=$JAVA_OPTS" 7 | echo "CMD Args: $@" 8 | 9 | java $JAVA_OPTS -jar "/openapi-eureka-${JAR_VERSION}.jar" "$@" 10 | -------------------------------------------------------------------------------- /cloud/eureka/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: openapi -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=1.0.0-SNAPSHOT 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melthaw/spring-backend-boilerplate/fff32bbc4cd895a5ae77d86ac78dffafe9894773/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jan 08 16:06:20 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip 7 | -------------------------------------------------------------------------------- /identity/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | } -------------------------------------------------------------------------------- /identity/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=identity-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /identity/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':identity/core') 8 | 9 | } -------------------------------------------------------------------------------- /identity/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=identity-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /menu/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | 5 | compile project(':rbac/resource') 6 | } 7 | -------------------------------------------------------------------------------- /menu/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=menu-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/MenuModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu; 2 | 3 | import in.clouthink.daas.sbb.menu.core.MenuPlugin; 4 | import in.clouthink.daas.sbb.menu.core.MenuResourceProvider; 5 | import in.clouthink.daas.sbb.rbac.spi.ResourceProvider; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | import java.util.List; 11 | 12 | @Configuration 13 | public class MenuModuleConfiguration { 14 | 15 | @Bean 16 | @Autowired(required = false) 17 | public ResourceProvider menuResourceProvider(List menuPluginList) { 18 | return new MenuResourceProvider(menuPluginList); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/annotation/Action.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface Action { 12 | 13 | String code(); 14 | 15 | String name(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/annotation/EnableMenu.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.annotation; 2 | 3 | import org.springframework.context.annotation.Import; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * Enable the menu plugin, it means it's a menu plugin , can be registered into the repository by system automatically. 9 | * 10 | * @author dz 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @Import(EnableMenuImportSelector.class) 16 | public @interface EnableMenu { 17 | 18 | /** 19 | * @return what the plugin extends from. 20 | */ 21 | String extensionPointId(); 22 | 23 | /** 24 | * @return the plugin id of the menu plugin 25 | */ 26 | String pluginId(); 27 | 28 | /** 29 | * @return the menus provided by the plugin 30 | */ 31 | Menu[] menu(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/annotation/ExtensionPoint.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface ExtensionPoint { 12 | 13 | String id(); 14 | 15 | String description() default ""; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/annotation/Menu.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface Menu { 12 | 13 | boolean virtual() default false; 14 | 15 | boolean open() default false; 16 | 17 | String code(); 18 | 19 | String name(); 20 | 21 | int order() default Integer.MAX_VALUE; 22 | 23 | String[] patterns() default {}; 24 | 25 | Action[] actions() default {}; 26 | 27 | Metadata[] metadata() default {}; 28 | 29 | ExtensionPoint[] extensionPoint() default {}; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/annotation/Metadata.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface Metadata { 12 | 13 | enum ValueType { 14 | String, Boolean, Short, Integer, Long, BigDecimal; 15 | } 16 | 17 | String key(); 18 | 19 | String value(); 20 | 21 | ValueType type() default ValueType.String; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/core/DefaultMenuPlugin.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.core; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | public class DefaultMenuPlugin implements MenuPlugin { 10 | 11 | private String extensionPointId; 12 | 13 | private String pluginId; 14 | 15 | private List menu = new ArrayList<>(); 16 | 17 | @Override 18 | public String getExtensionPointId() { 19 | return extensionPointId; 20 | } 21 | 22 | public void setExtensionPointId(String extensionPointId) { 23 | this.extensionPointId = extensionPointId; 24 | } 25 | 26 | @Override 27 | public String getPluginId() { 28 | return pluginId; 29 | } 30 | 31 | public void setPluginId(String pluginId) { 32 | this.pluginId = pluginId; 33 | } 34 | 35 | @Override 36 | public List getMenu() { 37 | return menu; 38 | } 39 | 40 | public void setMenu(List menu) { 41 | this.menu = menu; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/core/MenuException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.core; 2 | 3 | import in.clouthink.daas.sbb.rbac.exception.ResourceException; 4 | 5 | /** 6 | * menu exception 7 | * 8 | * @author dz 9 | */ 10 | public class MenuException extends ResourceException { 11 | public MenuException() { 12 | } 13 | 14 | public MenuException(String message) { 15 | super(message); 16 | } 17 | 18 | public MenuException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public MenuException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public MenuException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 27 | super(message, cause, enableSuppression, writableStackTrace); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/core/MenuExtensionPoint.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.core; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class MenuExtensionPoint { 7 | 8 | private String id; 9 | 10 | private String description; 11 | 12 | public MenuExtensionPoint() { 13 | } 14 | 15 | public MenuExtensionPoint(String id) { 16 | this.id = id; 17 | } 18 | 19 | public MenuExtensionPoint(String id, String description) { 20 | this.id = id; 21 | this.description = description; 22 | } 23 | 24 | public String getId() { 25 | return id; 26 | } 27 | 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/core/MenuLoader.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.core; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.util.List; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface MenuLoader { 11 | 12 | /** 13 | * load from input stream 14 | * 15 | * @param inputStream 16 | * @return 17 | */ 18 | List load(InputStream inputStream); 19 | 20 | /** 21 | * load from file 22 | * 23 | * @param file 24 | * @return 25 | */ 26 | List load(File file); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /menu/core/src/main/java/in/clouthink/daas/sbb/menu/core/MenuPlugin.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.core; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public interface MenuPlugin { 9 | 10 | String getPluginId(); 11 | 12 | String getExtensionPointId(); 13 | 14 | List getMenu(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /menu/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':account/core') 8 | compile project(':security/core') 9 | compile project(':rbac/resource') 10 | compile project(':rbac/permission') 11 | compile project(':menu/core') 12 | 13 | } -------------------------------------------------------------------------------- /menu/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=menu-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /menu/rest/src/main/java/in/clouthink/daas/sbb/menu/MenuMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.menu.rest.controller", "in.clouthink.daas.sbb.menu.rest.support.mock"}) 8 | public class MenuMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /menu/rest/src/main/java/in/clouthink/daas/sbb/menu/MenuRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.menu.rest.controller", "in.clouthink.daas.sbb.menu.rest.support.impl"}) 9 | @Import({MenuModuleConfiguration.class, GlobalMenuConfiguration.class}) 10 | public class MenuRestModuleConfiguration { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /menu/rest/src/main/java/in/clouthink/daas/sbb/menu/rest/support/UserProfileExtensionRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.menu.rest.dto.Menu; 5 | import in.clouthink.daas.sbb.rbac.model.Action; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 11 | */ 12 | public interface UserProfileExtensionRestSupport { 13 | 14 | /** 15 | * 16 | * @param user 17 | * @return 18 | */ 19 | List getGrantedMenus(User user); 20 | 21 | /** 22 | * 23 | * @param code 24 | * @param user 25 | * @return 26 | */ 27 | List getGrantedActions(String code, User user); 28 | } 29 | -------------------------------------------------------------------------------- /menu/rest/src/main/java/in/clouthink/daas/sbb/menu/rest/support/mock/UserProfileExtensionRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.menu.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.menu.rest.dto.Menu; 5 | import in.clouthink.daas.sbb.menu.rest.support.UserProfileExtensionRestSupport; 6 | import in.clouthink.daas.sbb.rbac.model.Action; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * UserProfileExtensionRestSupport mocker 13 | * 14 | * @author dz 15 | */ 16 | @Component 17 | public class UserProfileExtensionRestSupportMockImpl implements UserProfileExtensionRestSupport { 18 | 19 | @Override 20 | public List getGrantedMenus(User user) { 21 | return null; 22 | } 23 | 24 | @Override 25 | public List getGrantedActions(String code, User user) { 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /menu/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':menu/core') 3 | compile project(':menu/rest') 4 | } -------------------------------------------------------------------------------- /menu/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=menu-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /menu/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.menu.MenuRestModuleConfiguration -------------------------------------------------------------------------------- /message/sms/aliyun/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.daas 5 | compile libs.aliyun 6 | 7 | compile project(':passcode/core') 8 | } 9 | -------------------------------------------------------------------------------- /message/sms/aliyun/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=sms-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /message/sms/aliyun/src/main/java/in/clouthink/daas/sbb/sms/aliyun/impl/AdvancedAliyunOptions.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.aliyun.impl; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.sms.aliyun") 9 | public class AdvancedAliyunOptions extends AliyunOptions { 10 | 11 | private String templateId; 12 | 13 | public String getTemplateId() { 14 | return templateId; 15 | } 16 | 17 | public void setTemplateId(String templateId) { 18 | this.templateId = templateId; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /message/sms/aliyun/src/main/java/in/clouthink/daas/sbb/sms/aliyun/impl/SmsException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.aliyun.impl; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class SmsException extends RuntimeException { 7 | 8 | public SmsException() { 9 | } 10 | 11 | public SmsException(String message) { 12 | super(message); 13 | } 14 | 15 | public SmsException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public SmsException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public SmsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /message/sms/history/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.daas 5 | compile libs.aliyun 6 | 7 | compile project(':passcode/core') 8 | compile project(':menu/core') 9 | } 10 | -------------------------------------------------------------------------------- /message/sms/history/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=sms-history 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/SmsHistoryMenuConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history; 2 | 3 | import in.clouthink.daas.sbb.menu.annotation.Action; 4 | import in.clouthink.daas.sbb.menu.annotation.EnableMenu; 5 | import in.clouthink.daas.sbb.menu.annotation.Menu; 6 | import in.clouthink.daas.sbb.menu.annotation.Metadata; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | 10 | /** 11 | * @author dz 12 | */ 13 | @Configuration 14 | @EnableMenu(pluginId = "plugin:menu:sms", 15 | extensionPointId = "extension:menu:system", 16 | menu = {@Menu(code = "menu:dashboard:sms", 17 | name = "短信发送记录", 18 | order = 2010, 19 | patterns = {"/api/smsHistories**", "/api/smsHistories/**"}, 20 | actions = {@Action(code = "retrieve", name = "查看")}, 21 | metadata = {@Metadata(key = "state", value = "dashboard.smsHistory.list")})}) 22 | public class SmsHistoryMenuConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/SmsHistoryMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.sms.history.rest.controller", 8 | "in.clouthink.daas.sbb.sms.history.rest.support.mock"}) 9 | public class SmsHistoryMockModuleConfiguration { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/SmsHistoryModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.sms.history.repository", 10 | "in.clouthink.daas.sbb.sms.history.event", 11 | "in.clouthink.daas.sbb.sms.history.service", 12 | "in.clouthink.daas.sbb.sms.history.rest.controller", 13 | "in.clouthink.daas.sbb.sms.history.rest.support.impl"}) 14 | @EnableMongoRepositories({"in.clouthink.daas.sbb.sms.history.repository"}) 15 | @Import({SmsHistoryMenuConfiguration.class}) 16 | public class SmsHistoryModuleConfiguration { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/domain/request/SmsHistoryQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.domain.request; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.model.SmsHistory; 4 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 5 | 6 | /** 7 | */ 8 | public interface SmsHistoryQueryRequest extends DateRangedQueryRequest { 9 | 10 | String getCellphone(); 11 | 12 | String getCategory(); 13 | 14 | SmsHistory.SmsStatus getStatus(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/repository/SmsHistoryRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.repository; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.model.SmsHistory; 4 | import in.clouthink.daas.sbb.sms.history.repository.custom.SmsHistoryRepositoryCustom; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | 9 | /** 10 | * @author dz 11 | */ 12 | public interface SmsHistoryRepository extends AbstractRepository, SmsHistoryRepositoryCustom { 13 | 14 | Page findByCategory(String category, Pageable pageable); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/repository/custom/SmsHistoryRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.model.SmsHistory; 4 | import in.clouthink.daas.sbb.sms.history.domain.request.SmsHistoryQueryRequest; 5 | import in.clouthink.daas.sbb.shared.repository.custom.AbstractCustomRepository; 6 | import org.springframework.data.domain.Page; 7 | 8 | /** 9 | * 短信发送记录持久层扩展 10 | */ 11 | public interface SmsHistoryRepositoryCustom extends AbstractCustomRepository { 12 | 13 | Page queryPage(SmsHistoryQueryRequest parameter); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/rest/support/SmsHistorySupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.rest.support; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.request.SmsHistoryQueryRequest; 4 | import in.clouthink.daas.sbb.sms.history.rest.dto.SmsHistorySummary; 5 | import org.springframework.data.domain.Page; 6 | 7 | public interface SmsHistorySupport { 8 | 9 | Page findPage(SmsHistoryQueryRequest request); 10 | } 11 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/rest/support/mock/SmsHistorySupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.request.SmsHistoryQueryRequest; 4 | import in.clouthink.daas.sbb.sms.history.rest.dto.SmsHistorySummary; 5 | import in.clouthink.daas.sbb.sms.history.rest.support.SmsHistorySupport; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * SmsHistorySupport mocker 11 | * 12 | * @author dz 13 | */ 14 | @Component 15 | public class SmsHistorySupportMockImpl implements SmsHistorySupport { 16 | 17 | @Override 18 | public Page findPage(SmsHistoryQueryRequest request) { 19 | return null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/service/SmsHistoryService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.service; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.model.SmsHistory; 4 | import in.clouthink.daas.sbb.sms.history.domain.request.SmsHistoryQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | public interface SmsHistoryService { 8 | 9 | Page findPage(SmsHistoryQueryRequest request); 10 | 11 | SmsHistory save(SmsHistory smsHistory); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /message/sms/history/src/main/java/in/clouthink/daas/sbb/sms/history/service/impl/SmsHistoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms.history.service.impl; 2 | 3 | import in.clouthink.daas.sbb.sms.history.domain.model.SmsHistory; 4 | import in.clouthink.daas.sbb.sms.history.domain.request.SmsHistoryQueryRequest; 5 | import in.clouthink.daas.sbb.sms.history.repository.SmsHistoryRepository; 6 | import in.clouthink.daas.sbb.sms.history.service.SmsHistoryService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.data.domain.Page; 9 | import org.springframework.stereotype.Service; 10 | 11 | @Service 12 | public class SmsHistoryServiceImpl implements SmsHistoryService { 13 | 14 | @Autowired 15 | private SmsHistoryRepository repository; 16 | 17 | @Override 18 | public Page findPage(SmsHistoryQueryRequest request) { 19 | return repository.queryPage(request); 20 | } 21 | 22 | @Override 23 | public SmsHistory save(SmsHistory smsHistory) { 24 | return repository.save(smsHistory); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /message/sms/mock/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.daas 5 | compile libs.aliyun 6 | 7 | compile project(':passcode/core') 8 | 9 | } 10 | -------------------------------------------------------------------------------- /message/sms/mock/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=sms-mock 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /message/sms/mock/src/main/java/in/clouthink/daas/sbb/sms/MockSmsModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms; 2 | 3 | import in.clouthink.daas.edm.EventListener; 4 | import in.clouthink.daas.sbb.sms.mock.PasscodeMessageEventListener; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MockSmsModuleConfiguration { 10 | 11 | @Bean 12 | public EventListener passcodeMessageEventListener() { 13 | return new PasscodeMessageEventListener(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /message/sms/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':security/core') 8 | compile project(':message/sms/history') 9 | compile project(':message/sms/aliyun') 10 | compile project(':message/sms/mock') 11 | 12 | } -------------------------------------------------------------------------------- /message/sms/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=sms-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /message/sms/rest/src/main/java/in/clouthink/daas/sbb/sms/DummySmsRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms; 2 | 3 | import in.clouthink.daas.sbb.sms.history.SmsHistoryModuleConfiguration; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @Import({MockSmsModuleConfiguration.class, SmsHistoryModuleConfiguration.class}) 9 | public class DummySmsRestModuleConfiguration { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /message/sms/rest/src/main/java/in/clouthink/daas/sbb/sms/SmsRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.sms; 2 | 3 | import in.clouthink.daas.sbb.sms.history.SmsHistoryModuleConfiguration; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @Import({AliyunSmsModuleConfiguration.class, SmsHistoryModuleConfiguration.class}) 9 | public class SmsRestModuleConfiguration { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /message/sms/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':message/sms/history') 3 | compile project(':message/sms/aliyun') 4 | compile project(':message/sms/mock') 5 | compile project(':message/sms/rest') 6 | } -------------------------------------------------------------------------------- /message/sms/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=sms-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /message/sms/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.sms.DummySmsRestModuleConfiguration -------------------------------------------------------------------------------- /openapi/.env: -------------------------------------------------------------------------------- 1 | MONGODB_HOST=mongodb 2 | MONGODB_PORT=27017 -------------------------------------------------------------------------------- /openapi/doc/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=openapi-doc 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /openapi/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | openapi-server: 4 | container_name: openapi-server 5 | build: 6 | context: ./server 7 | dockerfile: src/docker/Dockerfile 8 | depends_on: 9 | - mongodb-server 10 | links: 11 | - mongodb-server:${MONGODB_HOST} 12 | ports: 13 | - "8081:8080" 14 | - "8190:8190" 15 | environment: 16 | MONGODB_HOST: ${MONGODB_HOST} 17 | MONGODB_PORT: ${MONGODB_PORT} 18 | JAVA_OPTS: -Xdebug -Xmx1024m -Xms256m -Xrunjdwp:server=y,transport=dt_socket,address=8190,suspend=n 19 | mongodb-server: 20 | container_name: mongodb-server 21 | image: mongo 22 | -------------------------------------------------------------------------------- /openapi/server/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=openapi-server 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /openapi/server/src/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | from clouthinkin/jre 2 | 3 | ADD build/libs/openapi-server-1.0.0-SNAPSHOT.jar / 4 | ADD docker/container_files/ / 5 | 6 | RUN chmod +x /*.sh 7 | 8 | EXPOSE 8080 9 | EXPOSE 8090 10 | WORKDIR / 11 | ENTRYPOINT /docker-entrypoint.sh 12 | -------------------------------------------------------------------------------- /openapi/server/src/docker/container_files/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # start service accordingly 4 | JAR_VERSION=1.0.0-SNAPSHOT 5 | 6 | echo "Using JAVA_OPTS=$JAVA_OPTS" 7 | echo "CMD Args: $@" 8 | 9 | java $JAVA_OPTS -Dspring.config.location=/application.properties -jar "/openapi-server-${JAR_VERSION}.jar" "$@" 10 | -------------------------------------------------------------------------------- /passcode/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | } -------------------------------------------------------------------------------- /passcode/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=passcode-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/engine/PasscodeEngine.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.engine; 2 | 3 | 4 | import in.clouthink.daas.sbb.passcode.model.PasscodeRequest; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | public interface PasscodeEngine { 10 | 11 | void handlePasscodeRequest(PasscodeRequest request); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/exception/PasscodeException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public class PasscodeException extends BizException { 9 | 10 | public PasscodeException() { 11 | } 12 | 13 | public PasscodeException(String message) { 14 | super(message); 15 | } 16 | 17 | public PasscodeException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public PasscodeException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public PasscodeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/exception/RegisterException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | */ 7 | public class RegisterException extends BizException { 8 | 9 | public RegisterException() { 10 | } 11 | 12 | public RegisterException(String message) { 13 | super(message); 14 | } 15 | 16 | public RegisterException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public RegisterException(Throwable cause) { 21 | super(cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/model/PasscodeMessage.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class PasscodeMessage { 7 | 8 | private String cellphone; 9 | 10 | private String category; 11 | 12 | private String passcode; 13 | 14 | public String getCellphone() { 15 | return cellphone; 16 | } 17 | 18 | public void setCellphone(String cellphone) { 19 | this.cellphone = cellphone; 20 | } 21 | 22 | public String getCategory() { 23 | return category; 24 | } 25 | 26 | public void setCategory(String category) { 27 | this.category = category; 28 | } 29 | 30 | public String getPasscode() { 31 | return passcode; 32 | } 33 | 34 | public void setPasscode(String passcode) { 35 | this.passcode = passcode; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/model/PasscodeRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class PasscodeRequest { 7 | 8 | private String cellphone; 9 | 10 | private String category; 11 | 12 | public String getCellphone() { 13 | return cellphone; 14 | } 15 | 16 | public void setCellphone(String cellphone) { 17 | this.cellphone = cellphone; 18 | } 19 | 20 | public String getCategory() { 21 | return category; 22 | } 23 | 24 | public void setCategory(String category) { 25 | this.category = category; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/model/Passcodes.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public abstract class Passcodes { 7 | 8 | public static final String EVENT_GROUP_NAME = "passcode"; 9 | 10 | public static final String REGISTER = "REGISTER"; 11 | 12 | public static final String FORGET_PASSWORD = "FORGET_PASSWORD"; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /passcode/core/src/main/java/in/clouthink/daas/sbb/passcode/service/PasscodeService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.service; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface PasscodeService { 7 | 8 | void sendPasscode4Register(String cellphone); 9 | 10 | void sendPasscode4ForgetPassword(String cellphone); 11 | 12 | void validatePasscode4Register(String cellphone, String passcode); 13 | 14 | void validatePasscode4ForgetPassword(String cellphone, String passcode); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /passcode/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':account/core') 8 | compile project(':passcode/core') 9 | 10 | } -------------------------------------------------------------------------------- /passcode/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=account-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /passcode/impl/src/main/java/in/clouthink/daas/sbb/passcode/PasscodeConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.passcode") 8 | public class PasscodeConfigurationProperties { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /passcode/impl/src/main/java/in/clouthink/daas/sbb/passcode/PasscodeServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.passcode.service", 10 | "in.clouthink.daas.sbb.passcode.event", 11 | "in.clouthink.daas.sbb.passcode.engine"}) 12 | @EnableMongoRepositories({"in.clouthink.daas.sbb.passcode.repository"}) 13 | @EnableConfigurationProperties(PasscodeConfigurationProperties.class) 14 | public class PasscodeServiceModuleConfiguration { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /passcode/impl/src/main/java/in/clouthink/daas/sbb/passcode/repository/PasscodeRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.passcode.repository; 2 | 3 | 4 | import in.clouthink.daas.sbb.passcode.model.Passcode; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public interface PasscodeRepository extends AbstractRepository { 10 | 11 | Passcode findByCellphoneAndCategory(String cellphone, String category); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /rbac/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | 5 | compile project(':shared') 6 | compile project(':account/core') 7 | compile project(':account/impl') 8 | compile project(':rbac/resource') 9 | compile project(':rbac/permission') 10 | } 11 | -------------------------------------------------------------------------------- /rbac/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=rbac-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /rbac/impl/src/main/java/in/clouthink/daas/sbb/rbac/impl/repository/ResourceRoleRelationshipRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.impl.repository; 2 | 3 | import in.clouthink.daas.sbb.rbac.impl.model.ResourceRoleRelationship; 4 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 10 | */ 11 | public interface ResourceRoleRelationshipRepository extends AbstractRepository { 12 | 13 | ResourceRoleRelationship findByResourceCodeAndRoleCode(String resourceCode, String roleCode); 14 | 15 | List findListByResourceCode(String resourceCode); 16 | 17 | List findListByRoleCode(String roleCode); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /rbac/impl/src/test/java/in/clouthink/daas/sbb/rbac/impl/test/ResourceLoaderTest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.impl.test; 2 | 3 | /** 4 | */ 5 | public class ResourceLoaderTest { 6 | 7 | // @Test 8 | // public void testLoadJsonFile() { 9 | // InputStream inputStream = ResourceJsonLoader.class.getClassLoader() 10 | // .getResourceAsStream( 11 | // "in.clouthink.daas.sbb.rbac.impl.sample.json"); 12 | // List result = new ResourceJsonLoader().load(inputStream); 13 | // Assert.assertEquals(8, result.size()); 14 | // Assert.assertFalse(result.get(0).isVirtual()); 15 | // Assert.assertTrue(result.get(7).isVirtual()); 16 | // } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /rbac/permission/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.springSecurity 5 | 6 | compile project(':rbac/resource') 7 | 8 | } 9 | -------------------------------------------------------------------------------- /rbac/permission/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=rbac-permission 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/exception/PermissionException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.exception; 2 | 3 | /** 4 | * permission exception 5 | */ 6 | public class PermissionException extends RuntimeException { 7 | 8 | public PermissionException() { 9 | } 10 | 11 | public PermissionException(String message) { 12 | super(message); 13 | } 14 | 15 | public PermissionException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public PermissionException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/exception/PermissionNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.exception; 2 | 3 | /** 4 | * permission not found exception 5 | */ 6 | public class PermissionNotFoundException extends PermissionException { 7 | 8 | public PermissionNotFoundException() { 9 | } 10 | 11 | public PermissionNotFoundException(String message) { 12 | super(message); 13 | } 14 | 15 | public PermissionNotFoundException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public PermissionNotFoundException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/model/DefaultRole.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * The Role default impl 7 | */ 8 | public class DefaultRole implements Role, Serializable { 9 | 10 | private String code; 11 | 12 | private String name; 13 | 14 | public DefaultRole() { 15 | } 16 | 17 | public DefaultRole(String code, String name) { 18 | this.code = code; 19 | this.name = name; 20 | } 21 | 22 | @Override 23 | public String getCode() { 24 | return code; 25 | } 26 | 27 | public void setCode(String code) { 28 | this.code = code; 29 | } 30 | 31 | @Override 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/model/Permission.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * The permission def 5 | */ 6 | public interface Permission { 7 | 8 | /** 9 | * @return The resource instance 10 | */ 11 | Resource getResource(); 12 | 13 | /** 14 | * @return The role which will participate in the resource actions 15 | */ 16 | Role getRole(); 17 | 18 | /** 19 | * @return If the action is null or empty , it means any actions is allowed 20 | */ 21 | Action[] getGrantedActions(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/model/Role.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * The role def 5 | */ 6 | public interface Role { 7 | 8 | /** 9 | * @return the role code (unique in global) 10 | */ 11 | String getCode(); 12 | 13 | /** 14 | * @return the role name 15 | */ 16 | String getName(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/model/TypedCode.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * The abstraction for code (with type) 7 | */ 8 | public class TypedCode implements Serializable { 9 | 10 | /* 11 | * The name() of code 12 | */ 13 | private String type; 14 | 15 | /* 16 | * The code of RoleType 17 | */ 18 | private String code; 19 | 20 | public TypedCode(String type, String code) { 21 | this.type = type; 22 | this.code = code; 23 | } 24 | 25 | public String getType() { 26 | return type; 27 | } 28 | 29 | public String getCode() { 30 | return code; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/support/parser/RoleCodeParser.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.support.parser; 2 | 3 | import in.clouthink.daas.sbb.rbac.exception.PermissionException; 4 | import in.clouthink.daas.sbb.rbac.model.TypedCode; 5 | 6 | /** 7 | * Support format : 'the-role-type:the-actual-role-code'. 8 | */ 9 | public class RoleCodeParser implements RoleParser { 10 | 11 | @Override 12 | public TypedCode parse(String roleCode) { 13 | String[] splittedRoleCode = roleCode.split(":"); 14 | if (splittedRoleCode.length != 2) { 15 | throw new PermissionException("无效的角色编码表达式"); 16 | } 17 | 18 | return new TypedCode(splittedRoleCode[0], splittedRoleCode[1]); 19 | } 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/support/parser/RoleParser.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.support.parser; 2 | 3 | /** 4 | * The role parser abstraction 5 | */ 6 | public interface RoleParser { 7 | 8 | /** 9 | * take the role code and return the underlying role instance 10 | * 11 | * @param roleCode 12 | * @return 13 | */ 14 | T parse(String roleCode); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /rbac/permission/src/main/java/in/clouthink/daas/sbb/rbac/support/parser/SimpleRoleParser.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.support.parser; 2 | 3 | /** 4 | * The simple role parser , just take and return the input role code. 5 | */ 6 | public class SimpleRoleParser implements RoleParser { 7 | 8 | @Override 9 | public String parse(String roleCode) { 10 | return roleCode; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /rbac/resource/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | 5 | } 6 | -------------------------------------------------------------------------------- /rbac/resource/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=rbac-resource 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/ResourceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac; 2 | 3 | import in.clouthink.daas.sbb.rbac.repository.ResourceMemoryRepository; 4 | import in.clouthink.daas.sbb.rbac.repository.ResourceRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class ResourceModuleConfiguration { 11 | 12 | @Bean 13 | @Autowired 14 | public ResourceRepository resourceServiceImpl() { 15 | return new ResourceMemoryRepository(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/exception/ResourceException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.exception; 2 | 3 | /** 4 | * resource exception 5 | */ 6 | public class ResourceException extends RuntimeException { 7 | 8 | public ResourceException() { 9 | } 10 | 11 | public ResourceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ResourceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ResourceException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public ResourceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.exception; 2 | 3 | /** 4 | * resource not found exception 5 | */ 6 | public class ResourceNotFoundException extends ResourceException { 7 | 8 | public ResourceNotFoundException() { 9 | } 10 | 11 | public ResourceNotFoundException(String message) { 12 | super(message); 13 | } 14 | 15 | public ResourceNotFoundException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ResourceNotFoundException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/Action.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * The action def 5 | */ 6 | public interface Action { 7 | 8 | Action[] EMPTY_ACTIONS = new Action[0]; 9 | 10 | /** 11 | * The default helper method to create the action 12 | * 13 | * @param code 14 | * @param name 15 | * @return 16 | */ 17 | static Action from(String code, String name) { 18 | return new DefaultAction(code, name); 19 | } 20 | 21 | /** 22 | * @return the action code 23 | */ 24 | String getCode(); 25 | 26 | /** 27 | * @return the action name 28 | */ 29 | String getName(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/DefaultAction.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * The action default impl 9 | */ 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | public class DefaultAction implements Action, Serializable { 12 | 13 | private String code; 14 | 15 | private String name; 16 | 17 | public DefaultAction() { 18 | } 19 | 20 | public DefaultAction(String code, String name) { 21 | this.code = code; 22 | this.name = name; 23 | } 24 | 25 | @Override 26 | public String getCode() { 27 | return code; 28 | } 29 | 30 | public void setCode(String code) { 31 | this.code = code; 32 | } 33 | 34 | @Override 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/DefaultResourceChild.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * The ResourceChild default impl. 10 | */ 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | public class DefaultResourceChild extends DefaultResource implements MutableResourceChild, Serializable { 13 | 14 | private String parentCode; 15 | 16 | @Override 17 | public String getParentCode() { 18 | return parentCode; 19 | } 20 | 21 | public void setParentCode(String parentCode) { 22 | this.parentCode = parentCode; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/MutableResource.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | public interface MutableResource extends Resource { 10 | 11 | void setVirtual(boolean virtual); 12 | 13 | void setOpen(boolean open); 14 | 15 | void setCode(String code); 16 | 17 | void setName(String name); 18 | 19 | void setPatterns(List patterns); 20 | 21 | void setActions(List actions); 22 | 23 | void setMetadata(Map metadata); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/MutableResourceChild.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface MutableResourceChild extends MutableResource, ResourceChild { 7 | 8 | void setParentCode(String parentCode); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/ParentAware.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * The sub-class or sub-interface means it's a child 5 | * 6 | * @author dz 7 | */ 8 | public interface ParentAware { 9 | 10 | /** 11 | * @return the parent code 12 | */ 13 | String getParentCode(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/ResourceChild.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface ResourceChild extends Resource, ParentAware { 7 | } 8 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/model/ResourceMatcher.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.model; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface ResourceMatcher { 7 | 8 | boolean matched(Resource resource); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/spi/ResourceProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.spi; 2 | 3 | import in.clouthink.daas.sbb.rbac.model.Resource; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * The resource provider 9 | * 10 | * @author dz 11 | */ 12 | public interface ResourceProvider { 13 | 14 | /** 15 | * The resource provider's name (normally the module name) 16 | * 17 | * @return 18 | */ 19 | String getName(); 20 | 21 | /** 22 | * @return the resource list of the provider 23 | */ 24 | List listResources(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /rbac/resource/src/main/java/in/clouthink/daas/sbb/rbac/support/matcher/ResourceMatchers.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.support.matcher; 2 | 3 | import in.clouthink.daas.sbb.rbac.model.ResourceMatcher; 4 | 5 | /** 6 | * The ResourceMatcher utilities. 7 | * 8 | * @author dz 9 | */ 10 | public abstract class ResourceMatchers { 11 | 12 | private static ResourceAntPathMatcher resourceAntPathMatcher = new ResourceAntPathMatcher(); 13 | 14 | public final static ResourceMatcher matchAntPath(String url) { 15 | return (resource) -> resourceAntPathMatcher.matched(resource, url); 16 | } 17 | 18 | public final static ResourceMatcher matchType(String type) { 19 | return (resource) -> resource.getType().equals(type); 20 | } 21 | 22 | public final static ResourceMatcher matchCode(String code) { 23 | return (resource) -> resource.getCode().equals(code); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /rbac/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':account/core') 8 | compile project(':security/core') 9 | compile project(':rbac/resource') 10 | compile project(':rbac/permission') 11 | compile project(':rbac/impl') 12 | compile project(':menu/core') 13 | 14 | } -------------------------------------------------------------------------------- /rbac/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=rbac-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/RbacMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.rbac.rest.controller", "in.clouthink.daas.sbb.rbac.rest.support.mock"}) 8 | public class RbacMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/RbacRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.rbac.rest.controller", 9 | "in.clouthink.daas.sbb.rbac.rest.service", 10 | "in.clouthink.daas.sbb.rbac.rest.support.impl"}) 11 | @Import({RbacServiceModuleConfiguration.class, RbacMenuConfiguration.class}) 12 | public class RbacRestModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/dto/GrantResourceParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.dto; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class GrantResourceParameter { 7 | 8 | private String resourceCode; 9 | 10 | private String[] actionCodes = new String[0]; 11 | 12 | public String getResourceCode() { 13 | return resourceCode; 14 | } 15 | 16 | public void setResourceCode(String resourceCode) { 17 | this.resourceCode = resourceCode; 18 | } 19 | 20 | public String[] getActionCodes() { 21 | return actionCodes; 22 | } 23 | 24 | public void setActionCodes(String[] actionCodes) { 25 | this.actionCodes = actionCodes; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/service/ResourceCacheService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.service; 2 | 3 | import in.clouthink.daas.sbb.rbac.rest.dto.PrivilegedResourceWithChildren; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface ResourceCacheService { 11 | 12 | List listResources(); 13 | 14 | List listResources(boolean cached); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/support/PermissionRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.support; 2 | 3 | 4 | import in.clouthink.daas.sbb.rbac.impl.model.TypedRole; 5 | import in.clouthink.daas.sbb.rbac.rest.dto.GrantResourceParameter; 6 | import in.clouthink.daas.sbb.rbac.rest.dto.PrivilegedResourceWithChildren; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | */ 12 | public interface PermissionRestSupport { 13 | 14 | /** 15 | * @param typedRoleCode 16 | * @return 17 | */ 18 | List listGrantedResources(String typedRoleCode); 19 | 20 | /** 21 | * @param resourceCode 22 | * @return 23 | */ 24 | List listGrantedRoles(String resourceCode); 25 | 26 | /** 27 | * @param typedRoleCode 28 | * @param grantRequest 29 | */ 30 | void grantResourcesToRole(String typedRoleCode, GrantResourceParameter grantRequest); 31 | 32 | /** 33 | * @param typedRoleCode 34 | * @param resourceCode 35 | */ 36 | void revokeResourcesFromRole(String typedRoleCode, String resourceCode); 37 | } 38 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/support/ResourceRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.support; 2 | 3 | 4 | import in.clouthink.daas.sbb.rbac.rest.dto.PrivilegedResourceWithChildren; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | */ 10 | public interface ResourceRestSupport { 11 | 12 | /** 13 | * @return 14 | */ 15 | List listResources(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/support/impl/ResourceRestSupportImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.support.impl; 2 | 3 | import in.clouthink.daas.sbb.rbac.rest.dto.PrivilegedResourceWithChildren; 4 | import in.clouthink.daas.sbb.rbac.rest.service.ResourceCacheService; 5 | import in.clouthink.daas.sbb.rbac.rest.support.ResourceRestSupport; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.List; 10 | 11 | @Component 12 | public class ResourceRestSupportImpl implements ResourceRestSupport { 13 | 14 | @Autowired 15 | private ResourceCacheService resourceService; 16 | 17 | @Override 18 | public List listResources() { 19 | return resourceService.listResources(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /rbac/rest/src/main/java/in/clouthink/daas/sbb/rbac/rest/support/mock/ResourceRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.rbac.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.rbac.rest.dto.PrivilegedResourceWithChildren; 4 | import in.clouthink.daas.sbb.rbac.rest.support.ResourceRestSupport; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author dz 11 | */ 12 | @Component 13 | public class ResourceRestSupportMockImpl implements ResourceRestSupport { 14 | @Override 15 | public List listResources() { 16 | return null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /rbac/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':rbac/resource') 3 | compile project(':rbac/permission') 4 | compile project(':rbac/impl') 5 | compile project(':rbac/rest') 6 | } -------------------------------------------------------------------------------- /rbac/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=rbac-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /rbac/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.rbac.RbacRestModuleConfiguration -------------------------------------------------------------------------------- /sample/attachment/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.springSecurity 5 | compile libs.daas 6 | 7 | compile project(':shared') 8 | compile project(':account/core') 9 | compile project(':storage/core') 10 | 11 | } -------------------------------------------------------------------------------- /sample/attachment/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=attachment-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/attachment/core/src/main/java/in/clouthink/daas/sbb/attachment/domain/request/AttachmentQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.domain.request; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 9 | */ 10 | public interface AttachmentQueryRequest extends DateRangedQueryRequest { 11 | 12 | String getTitle(); 13 | 14 | String getCategory(); 15 | 16 | Boolean getPublished(); 17 | 18 | Date getCreatedAtBegin(); 19 | 20 | Date getCreatedAtEnd(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /sample/attachment/core/src/main/java/in/clouthink/daas/sbb/attachment/domain/request/DownloadAttachmentEvent.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.domain.request; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 6 | 7 | /** 8 | * The download attachment event 9 | */ 10 | public interface DownloadAttachmentEvent { 11 | 12 | String EVENT_NAME = DownloadAttachmentEvent.class.getName(); 13 | 14 | Attachment getAttachment(); 15 | 16 | User getUser(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /sample/attachment/core/src/main/java/in/clouthink/daas/sbb/attachment/domain/request/SaveAttachmentRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.domain.request; 2 | 3 | /** 4 | * The attachment save request 5 | */ 6 | public interface SaveAttachmentRequest { 7 | 8 | String getCategory(); 9 | 10 | String getTitle(); 11 | 12 | //不超过140个字 13 | String getSummary(); 14 | 15 | String getFileObjectId(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /sample/attachment/core/src/main/java/in/clouthink/daas/sbb/attachment/exception/AttachmentException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.exception; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | public class AttachmentException extends BizException { 6 | 7 | public AttachmentException() { 8 | } 9 | 10 | public AttachmentException(String message) { 11 | super(message); 12 | } 13 | 14 | public AttachmentException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public AttachmentException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sample/attachment/core/src/main/java/in/clouthink/daas/sbb/attachment/exception/AttachmentNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.exception; 2 | 3 | public class AttachmentNotFoundException extends AttachmentException { 4 | 5 | public AttachmentNotFoundException() { 6 | } 7 | 8 | public AttachmentNotFoundException(String message) { 9 | super(message); 10 | } 11 | 12 | public AttachmentNotFoundException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public AttachmentNotFoundException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sample/attachment/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.springSecurity 5 | compile libs.daas 6 | 7 | compile project(':shared') 8 | compile project(':sample/attachment/core') 9 | 10 | } -------------------------------------------------------------------------------- /sample/attachment/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=attachment-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/AttachmentConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.attachment") 8 | public class AttachmentConfigurationProperties { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/AttachmentServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.attachment.service", "in.clouthink.daas.sbb.attachment.event"}) 10 | @EnableMongoRepositories({"in.clouthink.daas.sbb.attachment.repository"}) 11 | @EnableConfigurationProperties(AttachmentConfigurationProperties.class) 12 | public class AttachmentServiceModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/event/DownloadAttachmentEventObject.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.event; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 6 | import in.clouthink.daas.sbb.attachment.domain.request.DownloadAttachmentEvent; 7 | 8 | /** 9 | * The download attachment event object 10 | */ 11 | public class DownloadAttachmentEventObject implements DownloadAttachmentEvent { 12 | 13 | private Attachment attachment; 14 | 15 | private User user; 16 | 17 | public DownloadAttachmentEventObject(Attachment attachment, User user) { 18 | this.attachment = attachment; 19 | this.user = user; 20 | } 21 | 22 | @Override 23 | public Attachment getAttachment() { 24 | return attachment; 25 | } 26 | 27 | @Override 28 | public User getUser() { 29 | return user; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/repository/AttachmentCategoryRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.attachment.domain.model.AttachmentCategory; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | 9 | /** 10 | * the attachment category persist service 11 | */ 12 | public interface AttachmentCategoryRepository extends AbstractRepository { 13 | 14 | Page findByCreatedBy(User createdBy, Pageable pageable); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/repository/AttachmentDownloadHistoryRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 5 | import in.clouthink.daas.sbb.attachment.domain.model.AttachmentDownloadHistory; 6 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | 10 | /** 11 | * the attachment download history persist service 12 | */ 13 | public interface AttachmentDownloadHistoryRepository extends AbstractRepository { 14 | 15 | Page findByAttachment(Attachment attachment, Pageable pageable); 16 | 17 | AttachmentDownloadHistory findByAttachmentAndDownloadedBy(Attachment attachment, User user); 18 | 19 | int countByAttachment(Attachment attachment); 20 | 21 | } -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/repository/AttachmentRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.repository; 2 | 3 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 4 | import in.clouthink.daas.sbb.attachment.repository.custom.AttachmentRepositoryCustom; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | 9 | /** 10 | * the attachment persist service 11 | */ 12 | public interface AttachmentRepository extends AbstractRepository, AttachmentRepositoryCustom { 13 | 14 | Page findByPublished(boolean published, Pageable pageable); 15 | 16 | } -------------------------------------------------------------------------------- /sample/attachment/impl/src/main/java/in/clouthink/daas/sbb/attachment/repository/custom/AttachmentRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 4 | import in.clouthink.daas.sbb.attachment.domain.request.AttachmentQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | public interface AttachmentRepositoryCustom { 8 | 9 | Page queryPage(AttachmentQueryRequest queryRequest); 10 | 11 | void updateDownloadCounter(String id, int downloadCounter); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sample/attachment/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.springSecurity 5 | compile libs.daas 6 | 7 | compile project(':shared') 8 | compile project(':security/core') 9 | compile project(':account/core') 10 | compile project(':sample/attachment/core') 11 | compile project(':sample/attachment/impl') 12 | compile project(':menu/core') 13 | 14 | } -------------------------------------------------------------------------------- /sample/attachment/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=attachment-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/attachment/rest/src/main/java/in/clouthink/daas/sbb/attachment/AttachmentMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.attachment.rest.controller", 8 | "in.clouthink.daas.sbb.attachment.rest.support.mock"}) 9 | public class AttachmentMockModuleConfiguration { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /sample/attachment/rest/src/main/java/in/clouthink/daas/sbb/attachment/AttachmentRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.attachment.rest.controller", 9 | "in.clouthink.daas.sbb.attachment.rest.support.impl"}) 10 | @Import({AttachmentServiceModuleConfiguration.class, AttachmentMenuConfiguration.class}) 11 | public class AttachmentRestModuleConfiguration { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sample/attachment/rest/src/main/java/in/clouthink/daas/sbb/attachment/rest/dto/AttachmentDetail.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.attachment.rest.dto; 2 | 3 | import in.clouthink.daas.sbb.attachment.domain.model.Attachment; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | /** 7 | * 8 | */ 9 | @ApiModel 10 | public class AttachmentDetail extends AttachmentSummary { 11 | 12 | public static AttachmentDetail from(Attachment attachment, Object fileObject) { 13 | if (attachment == null) { 14 | return null; 15 | } 16 | AttachmentDetail result = new AttachmentDetail(); 17 | convert(attachment, result); 18 | result.setFileObject(fileObject); 19 | return result; 20 | } 21 | 22 | //附件关联的存储对象,例如daas fss object 23 | private Object fileObject; 24 | 25 | public Object getFileObject() { 26 | return fileObject; 27 | } 28 | 29 | public void setFileObject(Object fileObject) { 30 | this.fileObject = fileObject; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /sample/attachment/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':sample/attachment/core') 3 | compile project(':sample/attachment/impl') 4 | compile project(':sample/attachment/rest') 5 | } -------------------------------------------------------------------------------- /sample/attachment/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=attachment-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/attachment/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.attachment.AttachmentRestModuleConfiguration -------------------------------------------------------------------------------- /sample/news/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | 4 | compile project(':shared') 5 | compile project(':account/core') 6 | 7 | } 8 | -------------------------------------------------------------------------------- /sample/news/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=news-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/domain/request/NewsQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.domain.request; 2 | 3 | import in.clouthink.daas.sbb.news.domain.model.News; 4 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * 10 | */ 11 | public interface NewsQueryRequest extends DateRangedQueryRequest { 12 | 13 | String getTitle(); 14 | 15 | String getCategory(); 16 | 17 | Boolean getPublished(); 18 | 19 | Date getCreatedAtBegin(); 20 | 21 | Date getCreatedAtEnd(); 22 | 23 | News.NewsType getNewsType(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/domain/request/ReadNewsEvent.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.domain.request; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.news.domain.model.News; 6 | 7 | /** 8 | */ 9 | public interface ReadNewsEvent { 10 | 11 | String EVENT_NAME = ReadNewsEvent.class.getName(); 12 | 13 | News getNews(); 14 | 15 | User getUser(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/domain/request/SaveNewsRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.domain.request; 2 | 3 | 4 | import in.clouthink.daas.sbb.news.domain.model.News; 5 | 6 | /** 7 | * 8 | */ 9 | public interface SaveNewsRequest { 10 | 11 | String getCategory(); 12 | 13 | String getTitle(); 14 | 15 | // 不超过140个字 16 | String getSummary(); 17 | 18 | String getContent(); 19 | 20 | News.NewsType getNewsType(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/exception/NewsAttachmentException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.exception; 2 | 3 | /** 4 | * 5 | */ 6 | public class NewsAttachmentException extends NewsException { 7 | 8 | public NewsAttachmentException() { 9 | } 10 | 11 | public NewsAttachmentException(String message) { 12 | super(message); 13 | } 14 | 15 | public NewsAttachmentException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public NewsAttachmentException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/exception/NewsException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.exception; 2 | 3 | /** 4 | * 5 | */ 6 | public class NewsException extends RuntimeException { 7 | public NewsException() { 8 | } 9 | 10 | public NewsException(String message) { 11 | super(message); 12 | } 13 | 14 | public NewsException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public NewsException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sample/news/core/src/main/java/in/clouthink/daas/sbb/news/exception/NewsNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.exception; 2 | 3 | /** 4 | * 5 | */ 6 | public class NewsNotFoundException extends NewsException { 7 | 8 | public NewsNotFoundException() { 9 | } 10 | 11 | public NewsNotFoundException(String message) { 12 | super(message); 13 | } 14 | 15 | public NewsNotFoundException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public NewsNotFoundException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sample/news/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':sample/news/core') 8 | 9 | } 10 | -------------------------------------------------------------------------------- /sample/news/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=news-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/NewsConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.news") 8 | public class NewsConfigurationProperties { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/NewsServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.news.service"}) 10 | @EnableMongoRepositories({"in.clouthink.daas.sbb.news.repository"}) 11 | @EnableConfigurationProperties({NewsConfigurationProperties.class}) 12 | public class NewsServiceModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/repository/NewsCategoryRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.repository; 2 | 3 | import in.clouthink.daas.sbb.news.domain.model.NewsCategory; 4 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 5 | import in.clouthink.daas.security.token.core.User; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | 9 | /** 10 | * 11 | */ 12 | public interface NewsCategoryRepository extends AbstractRepository { 13 | 14 | Page findByCreatedBy(User createdBy, Pageable pageable); 15 | 16 | } -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/repository/NewsReadHistoryRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.repository; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.news.domain.model.News; 5 | import in.clouthink.daas.sbb.news.domain.model.NewsReadHistory; 6 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | 10 | /** 11 | */ 12 | public interface NewsReadHistoryRepository extends AbstractRepository { 13 | 14 | Page findByNews(News news, Pageable pageable); 15 | 16 | NewsReadHistory findByNewsAndReadBy(News news, User user); 17 | 18 | int countByNews(News news); 19 | 20 | } -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/repository/NewsRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.repository; 2 | 3 | import in.clouthink.daas.sbb.news.domain.model.News; 4 | import in.clouthink.daas.sbb.news.repository.custom.NewsRepositoryCustom; 5 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 6 | import org.springframework.data.domain.Page; 7 | import org.springframework.data.domain.Pageable; 8 | 9 | /** 10 | * 11 | */ 12 | public interface NewsRepository extends AbstractRepository, NewsRepositoryCustom { 13 | 14 | Page findByPublished(boolean published, Pageable pageable); 15 | 16 | } -------------------------------------------------------------------------------- /sample/news/impl/src/main/java/in/clouthink/daas/sbb/news/repository/custom/NewsRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.repository.custom; 2 | 3 | import in.clouthink.daas.sbb.news.domain.model.News; 4 | import in.clouthink.daas.sbb.news.domain.request.NewsQueryRequest; 5 | import org.springframework.data.domain.Page; 6 | 7 | public interface NewsRepositoryCustom { 8 | 9 | Page queryPage(NewsQueryRequest queryRequest); 10 | 11 | void updateReadCounter(String id, int readCounter); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sample/news/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':security/core') 8 | compile project(':account/core') 9 | compile project(':sample/news/core') 10 | compile project(':sample/news/impl') 11 | compile project(':menu/core') 12 | 13 | } -------------------------------------------------------------------------------- /sample/news/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=news-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/news/rest/src/main/java/in/clouthink/daas/sbb/news/NewsMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.news.rest.controller","in.clouthink.daas.sbb.news.rest.support.mock"}) 9 | public class NewsMockModuleConfiguration { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /sample/news/rest/src/main/java/in/clouthink/daas/sbb/news/NewsRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.news.rest.controller", "in.clouthink.daas.sbb.news.rest.support.impl"}) 9 | @Import({NewsServiceModuleConfiguration.class, NewsMenuConfiguration.class}) 10 | public class NewsRestModuleConfiguration { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /sample/news/rest/src/main/java/in/clouthink/daas/sbb/news/rest/dto/ReadNewsEventObject.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.rest.dto; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.news.domain.model.News; 6 | import in.clouthink.daas.sbb.news.domain.request.ReadNewsEvent; 7 | 8 | /** 9 | */ 10 | public class ReadNewsEventObject implements ReadNewsEvent { 11 | 12 | private News news; 13 | 14 | private User user; 15 | 16 | public ReadNewsEventObject(News news, User user) { 17 | this.news = news; 18 | this.user = user; 19 | } 20 | 21 | @Override 22 | public News getNews() { 23 | return news; 24 | } 25 | 26 | @Override 27 | public User getUser() { 28 | return user; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/news/rest/src/main/java/in/clouthink/daas/sbb/news/rest/support/NewsRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.news.rest.support; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.news.rest.dto.*; 5 | import in.clouthink.daas.sbb.shared.domain.request.impl.PageQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | 8 | /** 9 | * 10 | */ 11 | public interface NewsRestSupport { 12 | 13 | Page listNews(NewsQueryParameter queryRequest); 14 | 15 | NewsDetail getNewsDetail(String id); 16 | 17 | String createNews(SaveNewsParameter request, User user); 18 | 19 | void updateNews(String id, SaveNewsParameter request, User user); 20 | 21 | void deleteNews(String id, User user); 22 | 23 | void publishNews(String id, User user); 24 | 25 | void unpublishNews(String id, User user); 26 | 27 | Page listReadHistory(String id, PageQueryParameter queryParameter); 28 | 29 | void deleteAttachment(String id, String fileId, User user); 30 | } 31 | -------------------------------------------------------------------------------- /sample/news/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':sample/news/core') 3 | compile project(':sample/news/impl') 4 | compile project(':sample/news/rest') 5 | } -------------------------------------------------------------------------------- /sample/news/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=news-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/news/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.news.NewsRestModuleConfiguration -------------------------------------------------------------------------------- /sample/setting/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | 4 | compile project(':shared') 5 | compile project(':account/core') 6 | 7 | } 8 | -------------------------------------------------------------------------------- /sample/setting/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=setting-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/setting/core/src/main/java/in/clouthink/daas/sbb/setting/domain/request/SaveSystemSettingRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.domain.request; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface SaveSystemSettingRequest { 7 | 8 | /** 9 | * @return 10 | */ 11 | String getName(); 12 | 13 | /** 14 | * @return 15 | */ 16 | String getContactEmail(); 17 | 18 | /** 19 | * @return 20 | */ 21 | String getContactPhone(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /sample/setting/core/src/main/java/in/clouthink/daas/sbb/setting/exception/SystemSettingException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.exception; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class SystemSettingException extends RuntimeException { 7 | 8 | public SystemSettingException() { 9 | } 10 | 11 | public SystemSettingException(String message) { 12 | super(message); 13 | } 14 | 15 | public SystemSettingException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public SystemSettingException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public SystemSettingException(String message, 24 | Throwable cause, 25 | boolean enableSuppression, 26 | boolean writableStackTrace) { 27 | super(message, cause, enableSuppression, writableStackTrace); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/setting/core/src/main/java/in/clouthink/daas/sbb/setting/service/SystemSettingService.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.service; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.setting.domain.model.SystemSetting; 5 | import in.clouthink.daas.sbb.setting.domain.request.SaveSystemSettingRequest; 6 | 7 | /** 8 | * @author dz 9 | */ 10 | public interface SystemSettingService { 11 | 12 | SystemSetting getSystemSetting(); 13 | 14 | void saveSystemSetting(SaveSystemSettingRequest systemSetting, User byWho); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sample/setting/impl/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':sample/setting/core') 8 | 9 | } 10 | -------------------------------------------------------------------------------- /sample/setting/impl/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=setting-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/setting/impl/src/main/java/in/clouthink/daas/sbb/setting/SettingServiceModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 7 | 8 | @Configuration 9 | @ComponentScan({"in.clouthink.daas.sbb.setting.service"}) 10 | @EnableMongoRepositories({"in.clouthink.daas.sbb.setting.repository"}) 11 | public class SettingServiceModuleConfiguration { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sample/setting/impl/src/main/java/in/clouthink/daas/sbb/setting/repository/SystemSettingRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.repository; 2 | 3 | import in.clouthink.daas.sbb.setting.domain.model.SystemSetting; 4 | import in.clouthink.daas.sbb.shared.repository.AbstractRepository; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | public interface SystemSettingRepository extends AbstractRepository { 10 | 11 | } -------------------------------------------------------------------------------- /sample/setting/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | compile libs.daas 5 | 6 | compile project(':shared') 7 | compile project(':security/core') 8 | compile project(':sample/setting/core') 9 | compile project(':sample/setting/impl') 10 | compile project(':menu/core') 11 | 12 | } -------------------------------------------------------------------------------- /sample/setting/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=setting-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/SettingConfigurationProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting; 2 | 3 | import in.clouthink.daas.sbb.setting.rest.dto.SaveSystemSettingParameter; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.setting") 10 | public class SettingConfigurationProperties { 11 | 12 | private SaveSystemSettingParameter system = new SaveSystemSettingParameter(); 13 | 14 | public SaveSystemSettingParameter getSystem() { 15 | return system; 16 | } 17 | 18 | public void setSystem(SaveSystemSettingParameter system) { 19 | this.system = system; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/SystemSettingMenuConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting; 2 | 3 | import in.clouthink.daas.sbb.menu.annotation.Action; 4 | import in.clouthink.daas.sbb.menu.annotation.EnableMenu; 5 | import in.clouthink.daas.sbb.menu.annotation.Menu; 6 | import in.clouthink.daas.sbb.menu.annotation.Metadata; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | 10 | /** 11 | * @author dz 12 | */ 13 | @Configuration 14 | @EnableMenu(pluginId = "plugin:menu:setting", 15 | extensionPointId = "extension:menu:system", 16 | menu = {@Menu(code = "menu:dashboard:setting", 17 | name = "系统设置", 18 | order = 2020, 19 | patterns = {"/api/settings/system**", "/api/settings/system/**"}, 20 | actions = {@Action(code = "retrieve", name = "查看"), @Action(code = "update", name = "修改")}, 21 | metadata = {@Metadata(key = "state", value = "dashboard.systemSetting.list")})}) 22 | public class SystemSettingMenuConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/SystemSettingMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.setting.rest.controller", "in.clouthink.daas.sbb.setting.rest.support.mock"}) 8 | public class SystemSettingMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/SystemSettingRestModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.ComponentScan; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.Import; 8 | 9 | @Configuration 10 | @ComponentScan({"in.clouthink.daas.sbb.setting.rest.controller", "in.clouthink.daas.sbb.setting.rest.support.impl"}) 11 | @Import({SettingServiceModuleConfiguration.class, SystemSettingMenuConfiguration.class}) 12 | @EnableConfigurationProperties(SettingConfigurationProperties.class) 13 | public class SystemSettingRestModuleConfiguration { 14 | 15 | @Bean 16 | public SettingInitializingBean SettingInitializingBean() { 17 | return new SettingInitializingBean(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/rest/dto/SaveSystemSettingParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.rest.dto; 2 | 3 | 4 | import in.clouthink.daas.sbb.setting.domain.request.SaveSystemSettingRequest; 5 | 6 | /** 7 | * @author dz 8 | */ 9 | public class SaveSystemSettingParameter implements SaveSystemSettingRequest { 10 | 11 | private String name; 12 | 13 | private String contactEmail; 14 | 15 | private String contactPhone; 16 | 17 | @Override 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | @Override 27 | public String getContactEmail() { 28 | return contactEmail; 29 | } 30 | 31 | public void setContactEmail(String contactEmail) { 32 | this.contactEmail = contactEmail; 33 | } 34 | 35 | @Override 36 | public String getContactPhone() { 37 | return contactPhone; 38 | } 39 | 40 | public void setContactPhone(String contactPhone) { 41 | this.contactPhone = contactPhone; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/rest/support/SystemSettingRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.rest.support; 2 | 3 | 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.setting.domain.request.SaveSystemSettingRequest; 6 | import in.clouthink.daas.sbb.setting.rest.dto.SystemSettingSummary; 7 | 8 | /** 9 | * @author dz 10 | */ 11 | public interface SystemSettingRestSupport { 12 | 13 | SystemSettingSummary getSystemSetting(); 14 | 15 | void updateSystemSetting(SaveSystemSettingRequest updateSystemSetting, User byWho); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /sample/setting/rest/src/main/java/in/clouthink/daas/sbb/setting/rest/support/mock/SystemSettingRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.setting.rest.support.mock; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | import in.clouthink.daas.sbb.setting.domain.request.SaveSystemSettingRequest; 5 | import in.clouthink.daas.sbb.setting.rest.dto.SystemSettingSummary; 6 | import in.clouthink.daas.sbb.setting.rest.support.SystemSettingRestSupport; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * SystemSettingRestSupport mocker 11 | * 12 | * @author dz 13 | */ 14 | @Component 15 | public class SystemSettingRestSupportMockImpl implements SystemSettingRestSupport { 16 | 17 | @Override 18 | public SystemSettingSummary getSystemSetting() { 19 | return null; 20 | } 21 | 22 | @Override 23 | public void updateSystemSetting(SaveSystemSettingRequest updateSystemSetting, User byWho) { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/setting/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':sample/setting/core') 3 | compile project(':sample/setting/impl') 4 | compile project(':sample/setting/rest') 5 | } -------------------------------------------------------------------------------- /sample/setting/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=setting-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /sample/setting/starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.setting.SystemSettingRestModuleConfiguration -------------------------------------------------------------------------------- /security/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | } 5 | -------------------------------------------------------------------------------- /security/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=security-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /security/core/src/main/java/in/clouthink/daas/sbb/security/AuthenticationRequiredException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security; 2 | 3 | /** 4 | * If no authentication found in the security context, throw this. 5 | * 6 | * @author dz 7 | */ 8 | public class AuthenticationRequiredException extends RuntimeException { 9 | 10 | public AuthenticationRequiredException() { 11 | 12 | } 13 | 14 | public AuthenticationRequiredException(String message) { 15 | super(message); 16 | } 17 | 18 | public AuthenticationRequiredException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public AuthenticationRequiredException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public AuthenticationRequiredException(String message, 27 | Throwable cause, 28 | boolean enableSuppression, 29 | boolean writableStackTrace) { 30 | super(message, cause, enableSuppression, writableStackTrace); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /security/core/src/main/java/in/clouthink/daas/sbb/security/SecurityContext.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security; 2 | 3 | /** 4 | * The security context to get the authenticated user 5 | * 6 | * @author dz 7 | */ 8 | public interface SecurityContext { 9 | 10 | /** 11 | * @return current user , or null if not authenticated 12 | */ 13 | T currentUser(); 14 | 15 | /** 16 | * @return the current user 17 | * @throw AuthenticationRequiredException if not authenticated 18 | */ 19 | T requireUser(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /security/core/src/main/java/in/clouthink/daas/sbb/security/SecurityContexts.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security; 2 | 3 | import java.util.ServiceLoader; 4 | 5 | /** 6 | */ 7 | public class SecurityContexts { 8 | 9 | private static class SecurityContextHolder { 10 | 11 | static SecurityContext instance; 12 | 13 | static { 14 | ServiceLoader serviceLoader = ServiceLoader.load(SecurityContext.class); 15 | if (serviceLoader != null) { 16 | instance = serviceLoader.iterator().next(); 17 | } 18 | } 19 | 20 | } 21 | 22 | public static SecurityContext getContext() { 23 | return SecurityContextHolder.instance; 24 | } 25 | 26 | private SecurityContexts() { 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /security/jwt/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | 5 | compile project(':shared') 6 | compile project(':audit/impl') 7 | compile project(':account/core') 8 | compile project(':security/core') 9 | 10 | } 11 | -------------------------------------------------------------------------------- /security/jwt/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=security-jwt 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /security/jwt/src/main/java/in/clouthink/daas/sbb/security/SecurityModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.security.impl"}) 9 | @EnableMongoRepositories({"in.clouthink.daas.sbb.security.impl.auth"}) 10 | public class SecurityModuleConfiguration { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /security/jwt/src/main/java/in/clouthink/daas/sbb/security/impl/spring/UserDetails.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security.impl.spring; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | 5 | /** 6 | * 7 | */ 8 | public class UserDetails extends org.springframework.security.core.userdetails.User { 9 | 10 | private User user; 11 | 12 | public UserDetails(User user) { 13 | super(user.getUsername(), 14 | user.getPassword(), 15 | user.isEnabled(), 16 | !user.isExpired(), 17 | !user.isExpired(), 18 | !user.isLocked(), 19 | user.getAuthorities()); 20 | this.user = user; 21 | } 22 | 23 | public String getUserId() { 24 | return user.getId(); 25 | } 26 | 27 | public User getUser() { 28 | return user; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /security/jwt/src/main/java/in/clouthink/daas/sbb/security/impl/spring/rest/LogoutSuccessHandlerRestImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security.impl.spring.rest; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | /** 12 | * @author dz 13 | */ 14 | public class LogoutSuccessHandlerRestImpl implements LogoutSuccessHandler { 15 | 16 | @Override 17 | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 18 | throws IOException, ServletException { 19 | response.setStatus(HttpServletResponse.SC_OK); 20 | response.getWriter().append("{\"succeed\":true}"); 21 | response.flushBuffer(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /security/jwt/src/main/resources/META-INF/services/in.clouthink.daas.sbb.audit.security.SecurityContext: -------------------------------------------------------------------------------- 1 | in.clouthink.daas.sbb.security.impl.audit.SecurityContextAuditImpl -------------------------------------------------------------------------------- /security/jwt/src/main/resources/META-INF/services/in.clouthink.daas.sbb.security.SecurityContext: -------------------------------------------------------------------------------- 1 | in.clouthink.daas.sbb.security.impl.spring.SecurityContextImpl -------------------------------------------------------------------------------- /security/spring/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springSecurity 4 | 5 | compile project(':shared') 6 | compile project(':audit/impl') 7 | compile project(':account/core') 8 | compile project(':security/core') 9 | 10 | } 11 | -------------------------------------------------------------------------------- /security/spring/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=security-impl 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /security/spring/src/main/java/in/clouthink/daas/sbb/security/SecurityModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.sbb.security.impl"}) 9 | @EnableMongoRepositories({"in.clouthink.daas.sbb.security.impl.auth"}) 10 | public class SecurityModuleConfiguration { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /security/spring/src/main/java/in/clouthink/daas/sbb/security/impl/spring/UserDetails.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security.impl.spring; 2 | 3 | import in.clouthink.daas.sbb.account.domain.model.User; 4 | 5 | /** 6 | * 7 | */ 8 | public class UserDetails extends org.springframework.security.core.userdetails.User { 9 | 10 | private User user; 11 | 12 | public UserDetails(User user) { 13 | super(user.getUsername(), 14 | user.getPassword(), 15 | user.isEnabled(), 16 | !user.isExpired(), 17 | !user.isExpired(), 18 | !user.isLocked(), 19 | user.getAuthorities()); 20 | this.user = user; 21 | } 22 | 23 | public String getUserId() { 24 | return user.getId(); 25 | } 26 | 27 | public User getUser() { 28 | return user; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /security/spring/src/main/java/in/clouthink/daas/sbb/security/impl/spring/rest/LogoutSuccessHandlerRestImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.security.impl.spring.rest; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | /** 12 | * @author dz 13 | */ 14 | public class LogoutSuccessHandlerRestImpl implements LogoutSuccessHandler { 15 | 16 | @Override 17 | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 18 | throws IOException, ServletException { 19 | response.setStatus(HttpServletResponse.SC_OK); 20 | response.getWriter().append("{\"succeed\":true}"); 21 | response.flushBuffer(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /security/spring/src/main/resources/META-INF/services/in.clouthink.daas.sbb.audit.security.SecurityContext: -------------------------------------------------------------------------------- 1 | in.clouthink.daas.sbb.security.impl.audit.SecurityContextAuditImpl -------------------------------------------------------------------------------- /security/spring/src/main/resources/META-INF/services/in.clouthink.daas.sbb.security.SecurityContext: -------------------------------------------------------------------------------- 1 | in.clouthink.daas.sbb.security.impl.spring.SecurityContextImpl -------------------------------------------------------------------------------- /shared/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.commons 3 | compile libs.springBoot 4 | compile libs.springSecurity 5 | compile libs.springDataMongodb 6 | compile libs.swagger2 7 | } 8 | 9 | -------------------------------------------------------------------------------- /shared/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=shared 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/exception/BizException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.exception; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class BizException extends RuntimeException { 7 | 8 | public BizException() { 9 | } 10 | 11 | public BizException(String message) { 12 | super(message); 13 | } 14 | 15 | public BizException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public BizException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public BizException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/DomainConstants.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public class DomainConstants { 9 | 10 | /** 11 | * Email reg exp 12 | */ 13 | public final static Pattern VALID_EMAIL_REGEX = Pattern.compile( 14 | "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); 15 | 16 | /** 17 | * Cellphone reg exp 18 | */ 19 | public final static Pattern VALID_CELLPHONE_REGEX = Pattern.compile("^[1][1-9][0-9]{9}$"); 20 | 21 | public final static long HOW_LONG_OF_ONE_DAY = 24 * 60 * 60 * 1000l; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/converter/BigDecimalToDoubleConverter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.converter; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | * BigDecimal To Double Converter 10 | */ 11 | @Component 12 | public class BigDecimalToDoubleConverter implements Converter { 13 | 14 | @Override 15 | public Double convert(BigDecimal source) { 16 | return source.doubleValue(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/converter/DoubleToBigDecimalConverter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.converter; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.math.BigDecimal; 7 | import java.math.RoundingMode; 8 | 9 | /** 10 | * Double To BigDecimal Converter 11 | */ 12 | @Component 13 | public class DoubleToBigDecimalConverter implements Converter { 14 | 15 | @Override 16 | public BigDecimal convert(Double source) { 17 | return new BigDecimal(source).setScale(2, RoundingMode.HALF_UP); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/IntValueProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | public interface IntValueProvider extends ValueProvider {} 4 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/PasswordEncoder.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | /** 4 | */ 5 | public interface PasswordEncoder { 6 | 7 | String encode(String rawPassword, String salt); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/PasswordSaltProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | public interface PasswordSaltProvider { 4 | 5 | String getPasswordSalt(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/PublishableModel.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | import java.util.Date; 4 | 5 | public abstract class PublishableModel extends BaseModel { 6 | 7 | private boolean published = false; 8 | 9 | private Date publishedAt; 10 | 11 | private String publishedBy; 12 | 13 | public String getPublishedBy() { 14 | return publishedBy; 15 | } 16 | 17 | public void setPublishedBy(String publishedBy) { 18 | this.publishedBy = publishedBy; 19 | } 20 | 21 | public boolean isPublished() { 22 | return published; 23 | } 24 | 25 | public void setPublished(boolean published) { 26 | this.published = published; 27 | } 28 | 29 | public Date getPublishedAt() { 30 | return publishedAt; 31 | } 32 | 33 | public void setPublishedAt(Date publishedAt) { 34 | this.publishedAt = publishedAt; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/StringIdentifier.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | import org.springframework.data.annotation.Id; 4 | 5 | import java.io.Serializable; 6 | 7 | public abstract class StringIdentifier implements Serializable { 8 | 9 | public static String trim(String value) { 10 | if (value != null) { 11 | return value.trim(); 12 | } 13 | 14 | return value; 15 | } 16 | 17 | @Id 18 | String id; 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/StringValueProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | public interface StringValueProvider extends ValueProvider {} 4 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/ValueEnumSerializer.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | 7 | import java.io.IOException; 8 | 9 | public class ValueEnumSerializer extends JsonSerializer> { 10 | 11 | @Override 12 | public void serialize(ValueProvider value, JsonGenerator jgen, SerializerProvider provider) throws IOException { 13 | if (StringValueProvider.class.isAssignableFrom(value.getClass())) { 14 | jgen.writeString((String) value.getValue()); 15 | } else if (IntValueProvider.class.isAssignableFrom(value.getClass())) { 16 | jgen.writeNumber((Integer) value.getValue()); 17 | } else { 18 | throw new IllegalArgumentException( 19 | String.format("Unsupported value enum type: %s", value.getClass().getName())); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/model/ValueProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.model; 2 | 3 | public interface ValueProvider { 4 | T getValue(); 5 | } 6 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/AbstractQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request; 2 | 3 | public interface AbstractQueryRequest { 4 | } 5 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/DateRangedQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request; 2 | 3 | 4 | import java.util.Date; 5 | 6 | /** 7 | * date ranged query request 8 | */ 9 | public interface DateRangedQueryRequest extends PageQueryRequest { 10 | 11 | /** 12 | * 13 | * @return 起始时间(包括在内) 14 | */ 15 | Date getBeginDate(); 16 | 17 | /** 18 | * 19 | * @return 结束时间(包括在内) 20 | */ 21 | Date getEndDate(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/PageQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request; 2 | 3 | /** 4 | * page query request 5 | */ 6 | public interface PageQueryRequest extends AbstractQueryRequest { 7 | 8 | /** 9 | * @return 0 as default 10 | */ 11 | int getStart(); 12 | 13 | /** 14 | * @return 20 as default 15 | */ 16 | int getLimit(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/PublishableQueryRequest.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request; 2 | 3 | /** 4 | * publish able query request 5 | */ 6 | public interface PublishableQueryRequest extends PageQueryRequest { 7 | 8 | Boolean getPublished(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/impl/DateRangedQueryParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request.impl; 2 | 3 | 4 | import in.clouthink.daas.sbb.shared.domain.request.DateRangedQueryRequest; 5 | import io.swagger.annotations.ApiModel; 6 | 7 | import java.util.Date; 8 | 9 | @ApiModel 10 | public class DateRangedQueryParameter extends PageQueryParameter implements DateRangedQueryRequest { 11 | 12 | private Date beginDate; 13 | 14 | private Date endDate; 15 | 16 | public Date getBeginDate() { 17 | return beginDate; 18 | } 19 | 20 | public void setBeginDate(Date beginDate) { 21 | this.beginDate = beginDate; 22 | } 23 | 24 | public Date getEndDate() { 25 | return endDate; 26 | } 27 | 28 | public void setEndDate(Date endDate) { 29 | this.endDate = endDate; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/impl/PageQueryParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request.impl; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.PageQueryRequest; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | /** 7 | * 分页查询参数实现 8 | */ 9 | @ApiModel 10 | public class PageQueryParameter implements PageQueryRequest { 11 | 12 | int start = 0; 13 | 14 | int limit = 20; 15 | 16 | public PageQueryParameter() { 17 | } 18 | 19 | public PageQueryParameter(int start, int limit) { 20 | setStart(start); 21 | setLimit(limit); 22 | } 23 | 24 | public int getStart() { 25 | return start; 26 | } 27 | 28 | public void setStart(int start) { 29 | if (start < 0) { 30 | start = 0; 31 | } 32 | this.start = start; 33 | } 34 | 35 | public int getLimit() { 36 | return limit; 37 | } 38 | 39 | public void setLimit(int limit) { 40 | if (limit <= 0) { 41 | limit = 20; 42 | } 43 | if (limit > 100) { 44 | limit = 100; 45 | } 46 | this.limit = limit; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/domain/request/impl/PublishableQueryParameter.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.domain.request.impl; 2 | 3 | import in.clouthink.daas.sbb.shared.domain.request.PublishableQueryRequest; 4 | import io.swagger.annotations.ApiModel; 5 | 6 | @ApiModel 7 | public class PublishableQueryParameter extends PageQueryParameter implements PublishableQueryRequest { 8 | 9 | private Boolean published; 10 | 11 | public PublishableQueryParameter() { 12 | } 13 | 14 | public PublishableQueryParameter(int start, int limit) { 15 | super(start, limit); 16 | } 17 | 18 | @Override 19 | public Boolean getPublished() { 20 | return published; 21 | } 22 | 23 | public void setPublished(Boolean published) { 24 | this.published = published; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/repository/AbstractRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.repository; 2 | 3 | 4 | import org.springframework.data.repository.NoRepositoryBean; 5 | import org.springframework.data.repository.PagingAndSortingRepository; 6 | 7 | @NoRepositoryBean 8 | public interface AbstractRepository extends PagingAndSortingRepository { 9 | 10 | /** 11 | * Finds the individual record by the external facing id. This is used 12 | * instead of findOne, which finds based on the database id. 13 | * 14 | * @param id The Externally facing ID 15 | * @return the matching record 16 | */ 17 | T findById(String id); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/repository/custom/AbstractCustomRepository.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.repository.custom; 2 | 3 | import org.springframework.data.repository.NoRepositoryBean; 4 | 5 | @NoRepositoryBean 6 | public interface AbstractCustomRepository { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/repository/custom/impl/AbstractCustomRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.repository.custom.impl; 2 | 3 | import in.clouthink.daas.sbb.shared.repository.custom.AbstractCustomRepository; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.data.mongodb.core.MongoTemplate; 6 | import org.springframework.data.repository.NoRepositoryBean; 7 | 8 | @NoRepositoryBean 9 | public class AbstractCustomRepositoryImpl implements AbstractCustomRepository { 10 | 11 | @Autowired 12 | protected MongoTemplate mongoTemplate; 13 | 14 | public MongoTemplate getMongoTemplate() { 15 | return mongoTemplate; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/ErrorUtils.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util; 2 | 3 | public class ErrorUtils { 4 | 5 | public static String toString(Exception e) { 6 | StringBuffer result = new StringBuffer(); 7 | for (StackTraceElement element : e.getStackTrace()) { 8 | result.append(element.toString()).append("\n"); 9 | } 10 | return result.toString(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/ValidationException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util; 2 | 3 | import in.clouthink.daas.sbb.exception.BizException; 4 | 5 | /** 6 | * @author dz 7 | */ 8 | public class ValidationException extends BizException { 9 | 10 | public ValidationException() { 11 | } 12 | 13 | public ValidationException(String message) { 14 | super(message); 15 | } 16 | 17 | public ValidationException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public ValidationException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public ValidationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/ValidationUtils.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util; 2 | 3 | import in.clouthink.daas.sbb.shared.DomainConstants; 4 | import org.springframework.util.StringUtils; 5 | 6 | public class ValidationUtils { 7 | 8 | /** 9 | * @param email 可为空,但是格式必须正确 10 | */ 11 | public static void validateEmail(String email) { 12 | if (!StringUtils.isEmpty(email) && DomainConstants.VALID_EMAIL_REGEX.matcher(email).matches()) { 13 | throw new ValidationException("电子邮箱格式错误."); 14 | } 15 | } 16 | 17 | /** 18 | * @param cellphone 不能为空且格式必须正确 19 | */ 20 | public static void validateCellphone(String cellphone) { 21 | if (StringUtils.isEmpty(cellphone)) { 22 | throw new ValidationException("手机号码不能为空."); 23 | } 24 | if (!DomainConstants.VALID_CELLPHONE_REGEX.matcher(cellphone).matches()) { 25 | throw new ValidationException("无效的手机号码."); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/impl/BaiduShortUrlGenerator.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util.impl; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class BaiduShortUrlGenerator implements ShortUrlGenerator { 7 | 8 | @Override 9 | public String shorten(String url) { 10 | throw new UnsupportedOperationException(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/impl/ShortUrlGenerator.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util.impl; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface ShortUrlGenerator { 7 | 8 | String shorten(String url); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /shared/src/main/java/in/clouthink/daas/sbb/shared/util/impl/SinaShortUrlGenerator.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.shared.util.impl; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public class SinaShortUrlGenerator implements ShortUrlGenerator { 7 | 8 | @Override 9 | public String shorten(String url) { 10 | throw new UnsupportedOperationException(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /storage/README.md: -------------------------------------------------------------------------------- 1 | # guide 2 | 3 | 4 | * gradle 5 | 6 | 7 | ``` 8 | compile project(':passcode/impl') 9 | ``` 10 | 11 | * spring boot - java startup 12 | 13 | ``` 14 | public static void main(String[] args) { 15 | SpringApplication.run(new Object[]{AccountModuleConfiguration.class, 16 | RepositoryModuleConfiguration.class, 17 | ServiceModuleConfiguration.class, 18 | EventModuleConfiguration.class, 19 | RbacModuleConfiguration.class, 20 | AuditModuleConfiguration.class, 21 | GridfsModuleConfiguration.class, 22 | AttachmentModuleConfiguration.class, 23 | DashApiModuleConfiguration.class, 24 | SecurityBackendModuleConfiguration.class, 25 | DashboardApplication.class}, args); 26 | } 27 | 28 | 29 | ``` 30 | 31 | * spring boot - configuration 32 | 33 | add to your `application.properties` 34 | 35 | ``` 36 | in.clouthink.daas.sbb.account= 37 | 38 | ``` 39 | -------------------------------------------------------------------------------- /storage/alioss/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.daas 5 | 6 | compile project(":storage/core") 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/alioss/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-alioss 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /storage/alioss/src/main/java/in/clouthink/daas/sbb/storage/alioss/AliossConfigureProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.alioss; 2 | 3 | import in.clouthink.daas.fss.alioss.support.impl.DefaultOssProperties; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.storage.alioss") 7 | public class AliossConfigureProperties extends DefaultOssProperties { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /storage/core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.daas 5 | 6 | } 7 | -------------------------------------------------------------------------------- /storage/core/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-core 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /storage/core/src/main/java/in/clouthink/daas/sbb/storage/exception/FileException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.exception; 2 | 3 | /** 4 | */ 5 | public class FileException extends RuntimeException { 6 | 7 | public FileException() { 8 | } 9 | 10 | public FileException(String message) { 11 | super(message); 12 | } 13 | 14 | public FileException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public FileException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /storage/core/src/main/java/in/clouthink/daas/sbb/storage/exception/FileNotFoundException.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.exception; 2 | 3 | /** 4 | */ 5 | public class FileNotFoundException extends RuntimeException { 6 | 7 | public FileNotFoundException() { 8 | } 9 | 10 | public FileNotFoundException(String message) { 11 | super(message); 12 | } 13 | 14 | public FileNotFoundException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public FileNotFoundException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /storage/core/src/main/java/in/clouthink/daas/sbb/storage/spi/DownloadUrlProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.spi; 2 | 3 | /** 4 | * The download url provider because different storage service stored the file in different way. 5 | */ 6 | public interface DownloadUrlProvider { 7 | 8 | /** 9 | * @param id 10 | * @return the download url of specified attachment by id 11 | */ 12 | String getDownloadUrl(String id); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /storage/gridfs/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.daas 5 | 6 | compile project(":storage/core") 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/gridfs/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-gridfs 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /storage/gridfs/src/main/java/in/clouthink/daas/sbb/storage/GridfsConfigureProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.storage.gridfs") 6 | public class GridfsConfigureProperties { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/gridfs/src/main/java/in/clouthink/daas/sbb/storage/GridfsModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import in.clouthink.daas.fss.mongodb.MongoModuleConfiguration; 4 | import in.clouthink.daas.sbb.storage.gridfs.GridfsDownloadUrlProvider; 5 | import in.clouthink.daas.sbb.storage.spi.DownloadUrlProvider; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.context.annotation.Import; 10 | 11 | @Configuration 12 | @EnableConfigurationProperties(GridfsConfigureProperties.class) 13 | @Import({MongoModuleConfiguration.class}) 14 | public class GridfsModuleConfiguration { 15 | 16 | @Bean 17 | public DownloadUrlProvider storageService() { 18 | return new GridfsDownloadUrlProvider(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /storage/gridfs/src/main/java/in/clouthink/daas/sbb/storage/gridfs/GridfsDownloadUrlProvider.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.gridfs; 2 | 3 | import in.clouthink.daas.fss.core.FileObject; 4 | import in.clouthink.daas.fss.spi.FileObjectService; 5 | import in.clouthink.daas.sbb.storage.exception.FileNotFoundException; 6 | import in.clouthink.daas.sbb.storage.spi.DownloadUrlProvider; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | 9 | /** 10 | */ 11 | public class GridfsDownloadUrlProvider implements DownloadUrlProvider { 12 | 13 | @Autowired 14 | private FileObjectService fileObjectService; 15 | 16 | @Override 17 | public String getDownloadUrl(String id) { 18 | FileObject fileObject = fileObjectService.findById(id); 19 | if (fileObject == null) { 20 | throw new FileNotFoundException(id); 21 | } 22 | 23 | return "/api/download/" + fileObject.getFinalFilename(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /storage/localfs/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.daas 5 | 6 | compile project(":storage/core") 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/localfs/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-local 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /storage/localfs/src/main/java/in/clouthink/daas/sbb/storage/LocalfsConfigureProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.storage.local") 6 | public class LocalfsConfigureProperties { 7 | 8 | private String path = "/var/sbb/storage"; 9 | 10 | private String dowloadUrlPrefix = "/static/download"; 11 | 12 | public String getPath() { 13 | return path; 14 | } 15 | 16 | public void setPath(String path) { 17 | this.path = path; 18 | } 19 | 20 | public String getDowloadUrlPrefix() { 21 | return dowloadUrlPrefix; 22 | } 23 | 24 | public void setDowloadUrlPrefix(String dowloadUrlPrefix) { 25 | this.dowloadUrlPrefix = dowloadUrlPrefix; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /storage/localfs/src/main/java/in/clouthink/daas/sbb/storage/LocalfsModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import in.clouthink.daas.sbb.storage.local.LocalfsDownloadUrlProvider; 4 | import in.clouthink.daas.sbb.storage.spi.DownloadUrlProvider; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | @EnableConfigurationProperties({ConfigurationProperties.class}) 12 | public class LocalfsModuleConfiguration { 13 | 14 | @Bean 15 | public DownloadUrlProvider storageService() { 16 | return new LocalfsDownloadUrlProvider(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /storage/rest/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.daas 5 | 6 | compile project(":account/core") 7 | compile project(":security/core") 8 | compile project(":storage/core") 9 | compile project(":storage/alioss") 10 | compile project(":storage/gridfs") 11 | compile project(":storage/localfs") 12 | } 13 | -------------------------------------------------------------------------------- /storage/rest/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-rest 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /storage/rest/src/main/java/in/clouthink/daas/sbb/storage/StorageMockModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan({"in.clouthink.daas.sbb.storage.rest.controller", "in.clouthink.daas.sbb.storage.rest.support.mock"}) 8 | public class StorageMockModuleConfiguration { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /storage/rest/src/main/java/in/clouthink/daas/sbb/storage/StorageModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | @Configuration 8 | @ComponentScan({"in.clouthink.daas.fss.rest", 9 | "in.clouthink.daas.sbb.storage.rest.controller", 10 | "in.clouthink.daas.sbb.storage.rest.support.impl"}) 11 | @Import({GridfsModuleConfiguration.class}) 12 | public class StorageModuleConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /storage/rest/src/main/java/in/clouthink/daas/sbb/storage/support/AdvancedFileObjectQueryRestSupport.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.support; 2 | 3 | import in.clouthink.daas.fss.mongodb.model.FileObject; 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.storage.dto.DefaultFileObjectQueryParameter; 6 | import org.springframework.data.domain.Page; 7 | 8 | /** 9 | */ 10 | public interface AdvancedFileObjectQueryRestSupport { 11 | 12 | void deleteById(String id, User user); 13 | 14 | Page listFileObject(DefaultFileObjectQueryParameter queryParameter, User user); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /storage/rest/src/main/java/in/clouthink/daas/sbb/storage/support/mock/AdvancedFileObjectQueryRestSupportMockImpl.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.storage.support.mock; 2 | 3 | import in.clouthink.daas.fss.mongodb.model.FileObject; 4 | import in.clouthink.daas.sbb.account.domain.model.User; 5 | import in.clouthink.daas.sbb.storage.dto.DefaultFileObjectQueryParameter; 6 | import in.clouthink.daas.sbb.storage.support.AdvancedFileObjectQueryRestSupport; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * AdvancedFileObjectQueryRestSupport mocker 12 | * 13 | * @author dz 14 | */ 15 | @Component 16 | public class AdvancedFileObjectQueryRestSupportMockImpl implements AdvancedFileObjectQueryRestSupport { 17 | @Override 18 | public void deleteById(String id, User user) { 19 | 20 | } 21 | 22 | @Override 23 | public Page listFileObject(DefaultFileObjectQueryParameter queryParameter, User user) { 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /storage/rest/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.storage.StorageModuleConfiguration -------------------------------------------------------------------------------- /storage/starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":storage/core") 3 | compile project(":storage/alioss") 4 | compile project(":storage/gridfs") 5 | compile project(":storage/localfs") 6 | compile project(":storage/rest") 7 | } 8 | -------------------------------------------------------------------------------- /storage/starter/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=storage-starter 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /support/cors/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | } -------------------------------------------------------------------------------- /support/cors/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=support-cors 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /support/cors/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.support.cors.CorsSupportConfiguration -------------------------------------------------------------------------------- /support/security/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springDataMongodb 4 | compile libs.springSecurity 5 | compile libs.daas 6 | 7 | compile project(':shared') 8 | compile project(':security/spring') 9 | compile project(':account/starter') 10 | compile project(':audit/starter') 11 | compile project(':menu/starter') 12 | compile project(':rbac/starter') 13 | } 14 | -------------------------------------------------------------------------------- /support/security/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=support-security 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /support/security/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.support.security.OpenApiSecurityConfigurer -------------------------------------------------------------------------------- /support/session/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | compile libs.springRedis 4 | 5 | compile "org.springframework.session:spring-session-data-redis:1.3.1.RELEASE" 6 | } -------------------------------------------------------------------------------- /support/session/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=support-session 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /support/session/src/main/java/in/clouthink/daas/sbb/support/session/SpringSessionConfiguration.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.support.session; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; 5 | 6 | /** 7 | * Add the following config to your application.properties or application.yml 8 | *

9 | * 10 | * spring.redis.port=6379 11 | * spring.redis.host=127.0.0.1 12 | * spring.redis.password=****** 13 | * spring.redis.pool.max-active=100 14 | * spring.redis.pool.max-idle=5 15 | * spring.redis.pool.max-wait=60000 16 | *

17 | * spring.session.store-type=redis 18 | * spring.session.redis.namespace=openapi 19 | * 20 | */ 21 | @Configuration 22 | @EnableRedisHttpSession 23 | public class SpringSessionConfiguration { 24 | 25 | // @Bean 26 | // public JedisConnectionFactory connectionFactory() throws Exception { 27 | // return new JedisConnectionFactory(); 28 | // } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /support/session/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.support.session.SpringSessionConfiguration -------------------------------------------------------------------------------- /support/webhook/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile libs.springBoot 3 | } -------------------------------------------------------------------------------- /support/webhook/gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=in.clouthink.daas.sbb 2 | artifactId=support-webhook 3 | version=1.0.0-SNAPSHOT 4 | -------------------------------------------------------------------------------- /support/webhook/src/main/java/in/clouthink/daas/sbb/support/webhook/WebHookSupportProperties.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.support.webhook; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * Add the following config to your application.properties or application.yml 7 | *

8 | * 9 | * in.clouthink.daas.sbb.support.webhook.url= 10 | * 11 | */ 12 | @ConfigurationProperties(prefix = "in.clouthink.daas.sbb.support.webhook") 13 | public class WebHookSupportProperties { 14 | 15 | //please change it or override by configration 16 | //if the value is null or empty, the webhook feature will be disabled. 17 | private String url = "https://hook.bearychat.com/=bwBrq/incoming/403427090b0555b1804f0160f338ae29"; 18 | 19 | public String getUrl() { 20 | return url; 21 | } 22 | 23 | public void setUrl(String url) { 24 | this.url = url; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /support/webhook/src/main/java/in/clouthink/daas/sbb/support/webhook/client/WebHookClient.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.support.webhook.client; 2 | 3 | /** 4 | * @author dz 5 | */ 6 | public interface WebHookClient { 7 | 8 | /** 9 | * The implementation must handle the exception 10 | * 11 | * @param url 12 | * @param message 13 | */ 14 | void sendMessage(String url, String message); 15 | 16 | /** 17 | * The implementation must handle the exception 18 | * 19 | * @param url 20 | * @param message 21 | */ 22 | void sendMessage(String url, String message, String body); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /support/webhook/src/main/java/in/clouthink/daas/sbb/support/webhook/notify/AbstractNotification.java: -------------------------------------------------------------------------------- 1 | package in.clouthink.daas.sbb.support.webhook.notify; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.util.StringUtils; 5 | 6 | public class AbstractNotification { 7 | 8 | @Value("${app.name}") 9 | private String appName; 10 | 11 | @Value("${spring.application.name}") 12 | private String springApplicationName; 13 | 14 | String getAppName() { 15 | if (!StringUtils.isEmpty(springApplicationName)) { 16 | return springApplicationName; 17 | } 18 | if (!StringUtils.isEmpty(appName)) { 19 | return appName; 20 | } 21 | return "spring-backend-boilerplate"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /support/webhook/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | in.clouthink.daas.sbb.support.webhook.WebHookSupportConfiguration -------------------------------------------------------------------------------- /toolkit/paw/default.paw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melthaw/spring-backend-boilerplate/fff32bbc4cd895a5ae77d86ac78dffafe9894773/toolkit/paw/default.paw --------------------------------------------------------------------------------