Question: import com.upgrad.patterns.Authentication.AuthenticationProvider; import com.upgrad.patterns.Authentication.JwtAuthProvider; public class JwtAuthProcessor extends AuthenticationProcessor { public JwtAuthProcessor ( AuthenticationProcessor processor ) { super ( processor ) ; } / /

import com.upgrad.patterns.Authentication.AuthenticationProvider;
import com.upgrad.patterns.Authentication.JwtAuthProvider;
public class JwtAuthProcessor extends AuthenticationProcessor {
public JwtAuthProcessor(AuthenticationProcessor processor)
{
super(processor);
}
// If JWT token is provided, use it to authenticate
@Override
public boolean isAuthorized(AuthenticationProvider provider){
if(provider instanceof JwtAuthProvider)
{
return provider.Authenticate();
}
else if(nextProcessor != null)
{
return nextProcessor.isAuthorized(provider);
}
return false;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!