Skip to content

Commit 84b69d8

Browse files
committed
better pac4j integration
- add default action when user is not authenticated yet. fix #1147 - Problem upgrade to jooby 1.4 and pac4j2 fix #1128
1 parent a526192 commit 84b69d8

File tree

6 files changed

+348
-87
lines changed

6 files changed

+348
-87
lines changed

jooby/src/main/java/org/jooby/Jooby.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
import com.google.inject.Injector;
219219
import com.google.inject.Key;
220220
import com.google.inject.Provider;
221+
import com.google.inject.ProvisionException;
221222
import com.google.inject.Stage;
222223
import com.google.inject.TypeLiteral;
223224
import com.google.inject.internal.ProviderMethodsModule;
@@ -1203,7 +1204,15 @@ public Jooby on(final String env1, final String env2, final String env3,
12031204
public <T> T require(final Key<T> type) {
12041205
checkState(injector != null,
12051206
"Registry is not ready. Require calls are available at application startup time, see http://jooby.org/doc/#application-life-cycle");
1206-
return injector.getInstance(type);
1207+
try {
1208+
return injector.getInstance(type);
1209+
} catch (ProvisionException x) {
1210+
Throwable cause = x.getCause();
1211+
if (cause instanceof Err) {
1212+
throw (Err) cause;
1213+
}
1214+
throw x;
1215+
}
12071216
}
12081217

12091218
@Override

0 commit comments

Comments
 (0)