OpenHub defines basic security configuration out-of-box via GlobalSecurityConfig class. This configuration activates default Spring authentication manager as in-memory implementation with 3 types of user:

  • WS user (used for all web services)
  • WEB user (used for administration)
  • and MONITORING user (used for monitoring).

Each type of user owns a role that reflects expected behaviour and actions. See DefaultSecurityUsers (or class that collects all usernames and passwords for default users. To define which URL is secured by which role an OpenHub uses WebSecurityConfig, respectively AdminSecurityConfig classes.

Custom security

If custom security is required first of all is to define own global authentication via GlobalAuthenticationConfigurerAdapter (see GlobalSecurityConfig). Probably you will use #init(AuthenticationManagerBuilder) method to define authentication manager (manager of users and their roles). 

Second step is about security configuration - which role can what. You have to define own WebSecurityConfigurerAdapter with highest precedence than for example WsSecurityConfig.