3131import org .jooby .pac4j .Auth ;
3232import org .jooby .pac4j .AuthStore ;
3333import org .pac4j .core .client .Client ;
34- import org .pac4j .core .client .ClientFinder ;
3534import org .pac4j .core .client .Clients ;
3635import org .pac4j .core .client .DirectClient ;
3736import org .pac4j .core .client .IndirectClient ;
37+ import org .pac4j .core .client .finder .ClientFinder ;
3838import org .pac4j .core .context .Pac4jConstants ;
3939import org .pac4j .core .context .WebContext ;
4040import org .pac4j .core .credentials .Credentials ;
41- import org .pac4j .core .exception .RequiresHttpAction ;
41+ import org .pac4j .core .exception .HttpAction ;
4242import org .pac4j .core .exception .TechnicalException ;
43- import org .pac4j .core .profile .UserProfile ;
43+ import org .pac4j .core .profile .CommonProfile ;
4444import org .slf4j .Logger ;
4545import org .slf4j .LoggerFactory ;
4646
@@ -56,10 +56,10 @@ public class AuthFilter implements Route.Handler {
5656
5757 private String clientName ;
5858
59- private Class <? extends UserProfile > profileType ;
59+ private Class <? extends CommonProfile > profileType ;
6060
6161 public AuthFilter (final Class <? extends Client <?, ?>> clientType ,
62- final Class <? extends UserProfile > profileType ) {
62+ final Class <? extends CommonProfile > profileType ) {
6363 this .clientName = clientType .getSimpleName ();
6464 this .profileType = requireNonNull (profileType , "ProfileType is required." );
6565 }
@@ -81,12 +81,12 @@ public void handle(final Request req, final Response rsp) throws Throwable {
8181
8282 WebContext ctx = req .require (WebContext .class );
8383 ClientFinder finder = req .require (ClientFinder .class );
84- AuthStore <UserProfile > store = req .require (AuthStore .class );
84+ AuthStore <CommonProfile > store = req .require (AuthStore .class );
8585
8686 // stateless or previously authenticated stateful
87- UserProfile profile = find (finder , clients , ctx , null , clientName , client -> {
87+ CommonProfile profile = find (finder , clients , ctx , null , clientName , client -> {
8888 String profileId = profileID (useSession .test (client ), req );
89- UserProfile identity = profileId == null ? null : store .get (profileId ).orElse (null );
89+ CommonProfile identity = profileId == null ? null : store .get (profileId ).orElse (null );
9090
9191 if (identity == null ) {
9292 if (client instanceof DirectClient ) {
@@ -101,7 +101,7 @@ public void handle(final Request req, final Response rsp) throws Throwable {
101101 req .set (Auth .CNAME , client .getName ());
102102 store .set (identity );
103103 }
104- } catch (RequiresHttpAction e ) {
104+ } catch (HttpAction e ) {
105105 throw new TechnicalException ("Unexpected HTTP action" , e );
106106 }
107107 }
@@ -118,9 +118,9 @@ public void handle(final Request req, final Response rsp) throws Throwable {
118118 final String requestedUrl = ctx .getFullRequestURL ();
119119 log .debug ("requestedUrl: {}" , requestedUrl );
120120 ctx .setSessionAttribute (Pac4jConstants .REQUESTED_URL , requestedUrl );
121- client .redirect (ctx , true );
121+ client .redirect (ctx );
122122 rsp .end ();
123- } catch (RequiresHttpAction ex ) {
123+ } catch (HttpAction ex ) {
124124 new AuthResponse (rsp ).handle (client , ex );
125125 }
126126 return Boolean .TRUE ;
0 commit comments