In the end i figured it out by myself:
You need a custom authenticator
public class MyCustomAuthenticator extends DefaultAuthenticator { protected boolean authenticate(Principal user, String password) throws AuthenticatorException { return true; } protected Principal getUser(String username) { return getCrowdService().getUser(username); } private CrowdService getCrowdService() { return (CrowdService)ComponentManager.getComponent(CrowdService.class); } }
Add the MyCustomAuthenticator to seraph-config.xml
<authenticator class="com.company.jira.MyCustomAuthenticator"/>
Write a Custom Filter to set the user name from http-header
public class CustomFilter extends PasswordBasedLoginFilter { @Override protected UserPasswordPair extractUserPasswordPair( HttpServletRequest request) { String username = request.getHeader("iv-header"); if (username != null && username.trim().length() != 0) { return new PasswordBasedLoginFilter.UserPasswordPair( username, "DUMMY", false); } return null; } }
Replace the filter within the web.xml
<filter> <filter-name>login</filter-name> <filter-class>com.company.jira.CustomFilter</filter-class> </filter>
These jar's are needed for Jira 5.2
- embedded-crowd-api-2.6.2
- jira-core-5.2.1
- atlassian-seraph-2.6.0