
edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicScopeHandler Maven / Gradle / Ivy
package edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet;
import edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2SE;
import edu.uiuc.ncsa.security.delegation.server.ServiceTransaction;
import edu.uiuc.ncsa.security.oauth_2_0.UserInfo;
import edu.uiuc.ncsa.security.oauth_2_0.server.ScopeHandler;
import edu.uiuc.ncsa.security.oauth_2_0.server.UnsupportedScopeException;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
/**
* Created by Jeff Gaynor
* on 8/17/15 at 4:10 PM
*/
public class BasicScopeHandler implements ScopeHandler {
/**
* Optionally, the service environment may be injected into a scope handler to get configuration of
* components, e.g.
* @return
*/
public OA2SE getOa2SE() {
return oa2SE;
}
public void setOa2SE(OA2SE oa2SE) {
this.oa2SE = oa2SE;
}
OA2SE oa2SE;
Collection scopes;
@Override
public Collection getScopes() {
return scopes;
}
/**
* At the most basic level, this just returns the {@link UserInfo} object passed to it. Override as you deem fit.
*
* @param userInfo
* @param transaction
* @return
* @throws UnsupportedScopeException
*/
@Override
public UserInfo process(UserInfo userInfo, ServiceTransaction transaction) throws UnsupportedScopeException {
return process(userInfo, null, transaction);
}
/**
* This also just returns the {@link UserInfo} object passed in.
* @param userInfo
* @param request
* @param transaction
* @return
* @throws UnsupportedScopeException
*/
@Override
public UserInfo process(UserInfo userInfo, HttpServletRequest request, ServiceTransaction transaction) throws UnsupportedScopeException {
return userInfo;
}
@Override
public void setScopes(Collection scopes) {
this.scopes = scopes;
}
}