Hey, just a heads-up. I’ve found out the solution my self 
There is no detailed explanation but the trick is to send the user back to the callback for jwt authentication with a jwt-query param which contains a jwt token.
My configuration:
gitlab_rails['omniauth_providers'] = [
{
"name"=> "cas3",
"label"=> "Single Sign-On",
"args"=> {
"url"=> 'https://authy.xxxx.de',
"login_url"=> '/cas/login',
"service_validate_url"=> '/cas/validate',
"logout_url"=> '/cas/logout'
}
},
{
"name" => "jwt",
"label" => "Single Sign-On (Beta)",
"args" => {
"secret" => "xxxxxx",
"algorithm" => "HS512",
"uid_claim" => "email",
"required_claims" => ["sub", "email"],
"info_map" => {
"sub" => "name",
"email" => "email"
},
"auth_url" => "https://authy.xxxx.de/jwt/login?service=https://git.xxxx.de/users/auth/jwt/callback",
"valid_within" => 3600
}
}
]
The java code (does not work out of the box but should tell you enough to implement on your own)
@Slf4j
@RestController
@RequiredArgsConstructor
public class JwtAuthResourceImpl implements JwtAuthResource {
public ResponseEntity<LoginResponse> login(HttpServletRequest req, HttpServletResponse response, LoginRequest login, String serviceUrl) {
Tuple2<Identity, Service> authenticated = loginSecurity.authenticate(req, login, serviceUrl);
Service service = authenticated.getT2();
Identity identity = authenticated.getT1();
String token = issueCookie(response, identity, service);
return ResponseEntity.ok(
LoginResponse.builder()
.token(token)
.location(login.getCas() ? getRedirectLogin(serviceUrl, identity, service) : serviceUrl)
.message("OK")
.build()
);
}
@Override
public ResponseEntity<LoginResponse> loginPage(HttpServletRequest request, String serviceUrl) {
if (SecureContextRequestHelper.hasSecureContext(request)) {
SecureContext ctx = SecureContextRequestHelper.getSecureContext(request);
assert ctx != null;
Identity identity = ctx.getIdentity();
Service service = serviceValidation.getRegisteredServiceFor(serviceUrl);
if (service != null && service.getEnabled()) {
if (service.isIdentityAllowed(identity)) {
String redirectUrl = getRedirectLogin(serviceUrl, identity, service);
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT)
.header("Location", redirectUrl)
.body(LoginResponse.builder().location(redirectUrl).message("OK").build());
} else {
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(URI.create("/#/error?code=" + StatusCode.DENIED + "&service=" + serviceUrl + "&require2FA=" + service.getRequire2FA().toString())).build();
}
}
}
Service service = serviceValidation.getRegisteredServiceFor(serviceUrl);
if (service == null || !service.getEnabled()) {
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(URI.create("/#/error?code=" + StatusCode.INVALID_SERVICE + "&service=" + serviceUrl)).build();
}
if (serviceUrl.equals("/")) {
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(URI.create("/#/login?service=" + serviceUrl)).build();
} else {
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(URI.create("/#/jwt/login?service=" + serviceUrl)).build();
}
}
private String getRedirectLogin(String serviceUrl, Identity identity, Service service) {
if (serviceUrl.contains("?")) {
serviceUrl += "&";
} else {
serviceUrl += "?";
}
serviceUrl += "jwt=" + jwtProcessor.getJwtTokenFor(identity, service); // important part
return serviceUrl;
}
}