Klasse ProductionInterfaceSecurity

java.lang.Object
de.dlr.proseo.api.prip.ProductionInterfaceSecurity

@Component public class ProductionInterfaceSecurity extends Object
Security utility methods for PRIP API
Autor:
Dr. Thomas Bassler
  • Konstruktordetails

    • ProductionInterfaceSecurity

      public ProductionInterfaceSecurity()
  • Methodendetails

    • parseAuthenticationHeader

      OAuth2TokenManager.UserInfo parseAuthenticationHeader(String authHeader) throws IllegalArgumentException
      Parse an HTTP authentication header into mission, username and password and set the respective thread-local attributes
      Parameter:
      authHeader - the authentication header to parse, expected format: "Basic base64(mission\username:password)"
      Gibt zurück:
      the parsed UserInfo
      Löst aus:
      IllegalArgumentException - if the authentication header cannot be parsed into the three parts expected
    • doLogin

      public void doLogin(javax.servlet.http.HttpServletRequest request) throws SecurityException
      Log in to prosEO
      Parameter:
      request - the HTTP request containing the authentication header
      Löst aus:
      SecurityException - if the login failed for any reason
    • authenticateUser

      Check user credentials and authorities with User Manager
      Parameter:
      userInfo - a UserInfo object containing the user credentials
      Gibt zurück:
      the updated UserInfo object including authorities, if the authentication was successful and PRIP access is granted
      Löst aus:
      SecurityException - if the user could not be authenticated or is not authorized to access the PRIP API
    • getUser

      public String getUser()
      Gets the name of the logged in user for service authentication (including mission prefix)
      Gibt zurück:
      the user name or null, if no user is logged in
    • getPassword

      public String getPassword()
      Gets the password of the logged in user
      Gibt zurück:
      the password or null, if no user is logged in
    • getMission

      public String getMission()
      Gets the code of the mission the current user is logged in to
      Gibt zurück:
      the mission code or null, if no user is logged in
    • getAuthorities

      public List<String> getAuthorities()
      Gets the authorities granted to the user after login
      Gibt zurück:
      the granted authorities
    • hasRole

      public boolean hasRole(de.dlr.proseo.model.enums.UserRole role)
      Checks whether the logged in user has the given role
      Parameter:
      role - the user role to check
      Gibt zurück:
      true, if the respective authority was granted, false otherwise