/** * Does the given username and password authenticate for the * given DSpace Context? * * @param context * @param un * @param pw * @return true if yes, false if not */ public boolean authenticates(Context context, String un, String pw) { int auth = AuthenticationManager.authenticate(context, un, pw, null, null); if (auth == AuthenticationMethod.SUCCESS) { return true; } return false; }
/** * Determine if the EPerson (to be created or already created) has the * ability to set their own password. * * @param objectModel * The Cocoon object model * @param email * The email address of the EPerson. * @return */ public static boolean allowSetPassword(Map objectModel, String email) throws SQLException { final HttpServletRequest request = (HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT); Context context = ContextUtil.obtainContext(objectModel); return AuthenticationManager.allowSetPassword(context, request, email); }
int[] groupIDs = AuthenticationManager.getSpecialGroups(context, request);
Context context = ContextUtil.obtainContext(objectModel); int implicitStatus = AuthenticationManager.authenticateImplicit( context, null, null, null, request); int explicitStatus = AuthenticationManager.authenticate(context, email, password, realm, request);
if (AuthenticationManager.authenticateImplicit(context, null, null, null, request) == AuthenticationMethod.SUCCESS) Iterator ai = AuthenticationManager.authenticationMethodIterator(); AuthenticationMethod am; int count = 0;
AuthenticationManager.initEPerson(context, request, eperson); AuthenticationManager.allowSetPassword(context, request, eperson.getEmail())) boolean setPassword = AuthenticationManager.allowSetPassword( context, request, email); request.setAttribute("set.password", Boolean.valueOf(setPassword));
/** * Determine if the email can register itself or needs to be * created by a site administrator first. * * @param objectModel * The Cocoon object model * @param email * The email of the person to be registered. * @return true if the email can register, otherwise false. */ public static boolean canSelfRegister(Map objectModel, String email) throws SQLException { final HttpServletRequest request = (HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT); Context context = ContextUtil.obtainContext(objectModel); if (SystemwideAlerts.canUserStartSession()) { return AuthenticationManager.canSelfRegister(context, request, email); } else { // System wide alerts is preventing new sessions. return false; } }
/** * Perform implicit authentication. The authenticationManager will consult * the authentication stack for any methods that can implicitly authenticate * this session. If the attempt was successful then the returned context * will have an eperson attached other wise the context will not have an * eperson attached. * * @param objectModel * Cocoon's object model. * @return This requests DSpace context. */ public static Context authenticateImplicit(Map objectModel) throws SQLException { // Get the real HttpRequest final HttpServletRequest request = (HttpServletRequest) objectModel .get(HttpEnvironment.HTTP_REQUEST_OBJECT); Context context = ContextUtil.obtainContext(objectModel); int implicitStatus = AuthenticationManager.authenticateImplicit( context, null, null, null, request); if (implicitStatus == AuthenticationMethod.SUCCESS) { log.info(LogManager.getHeader(context, "login", "type=implicit")); AuthenticationUtil.logIn(context, request, context.getCurrentUser()); } return context; }
AuthenticationManager.initEPerson(context, request, eperson);
int[] groupIDs = AuthenticationManager.getSpecialGroups(c, request);
AuthenticationManager.canSelfRegister(context, request, email);
int[] groupIDs = AuthenticationManager.getSpecialGroups(context, request); for (int groupID : groupIDs)
/** * Does the given username and password authenticate for the * given DSpace Context? * * @param context * @param un * @param pw * @return true if yes, false if not */ public boolean authenticates(Context context, String un, String pw) { int auth = AuthenticationManager.authenticate(context, un, pw, null, null); if (auth == AuthenticationMethod.SUCCESS) { return true; } return false; } }
.get(HttpEnvironment.HTTP_REQUEST_OBJECT); final Iterator<AuthenticationMethod> authMethods = AuthenticationManager .authenticationMethodIterator();
AuthenticationManager.allowSetPassword(context, request, email); request.setAttribute("set.password", Boolean.valueOf(setPassword));
int[] groupIDs = AuthenticationManager.getSpecialGroups(context, request); for (int groupID : groupIDs)
int status = AuthenticationManager.authenticate(context, null, null, null, request);
WingException { Iterator authMethods = AuthenticationManager .authenticationMethodIterator(); Request request = ObjectModelHelper.getRequest(objectModel); HttpSession session = request.getSession();
sc.setAuthenticated(ep); int[] groupIDs = AuthenticationManager.getSpecialGroups(context, null); oboContext.setCurrentUser(epObo); int[] groupIDs = AuthenticationManager.getSpecialGroups(oboContext, null);