use of org.eclipse.microprofile.auth.LoginConfig in project Payara by payara.
the class CdiExtension method findLoginConfigAnnotation.
/**
* This method tries to find the LoginConfig annotation and if does flags that fact.
*/
public <T> void findLoginConfigAnnotation(@Observes ProcessBean<T> eventIn, BeanManager beanManager) {
// JDK8 u60 workaround
ProcessBean<T> event = eventIn;
LoginConfig loginConfig = event.getAnnotated().getAnnotation(LoginConfig.class);
if (loginConfig != null && loginConfig.authMethod().equals("MP-JWT")) {
addJWTAuthenticationMechanism = true;
}
}
use of org.eclipse.microprofile.auth.LoginConfig in project tomee by apache.
the class MPJWTInitializer method onStartup.
@Override
public void onStartup(final Set<Class<?>> classes, final ServletContext ctx) throws ServletException {
if (classes == null || classes.isEmpty()) {
// no class having @LoginConfig on it
return;
}
for (Class<?> clazz : classes) {
final LoginConfig loginConfig = clazz.getAnnotation(LoginConfig.class);
if (loginConfig.authMethod() == null && !"MP-JWT".equals(loginConfig.authMethod())) {
continue;
}
if (!Application.class.isAssignableFrom(clazz)) {
continue;
// do we really want Application?
// See https://github.com/eclipse/microprofile-jwt-auth/issues/70 to clarify this point
}
final FilterRegistration.Dynamic mpJwtFilter = ctx.addFilter("mp-jwt-filter", MPJWTFilter.class);
mpJwtFilter.setAsyncSupported(true);
mpJwtFilter.addMappingForUrlPatterns(null, false, "/*");
// no need to add it more than once
break;
}
}
Aggregations