public void authentication(AuthCredentials credentials) throws SwordAuthException { if (!exists(credentials.getUsername())) { throw new SwordAuthException("Wrong login data!"); } MCRUser mcrUser = login(credentials.getUsername(), credentials.getPassword()); if (mcrUser == null) { throw new SwordAuthException("Wrong login data!"); } } }
"sword-" + auth.getUsername() + "-" + (new Date()).getTime(); pw.println("On Behalf of=" + auth.getOnBehalfOf()); pw.println("Slug=" + deposit.getSlug()); pw.println("User name=" + auth.getUsername()); pw.close();
public SwordContext doAuth(AuthCredentials authCredentials) throws SwordAuthException, SwordError, DSpaceSwordException { // if there is no supplied username, then we should request a retry if (authCredentials.getUsername() == null) { throw new SwordAuthException(true); } // first authenticate the request // note: this will build our various DSpace contexts for us SwordAuthenticator auth = new SwordAuthenticator(); SwordContext sc = auth.authenticate(authCredentials); // log the request String un = authCredentials.getUsername() != null ? authCredentials.getUsername() : "NONE"; String obo = authCredentials.getOnBehalfOf() != null ? authCredentials.getOnBehalfOf() : "NONE"; log.info(LogManager.getHeader(sc.getContext(), "sword_auth_request", "username=" + un + ",on_behalf_of=" + obo)); return sc; }
"sword-" + auth.getUsername() + "-" + (new Date()).getTime(); pw.println("On Behalf of=" + auth.getOnBehalfOf()); pw.println("Slug=" + deposit.getSlug()); pw.println("User name=" + auth.getUsername()); pw.close();
public AuthenticatedUser auth(AuthCredentials authCredentials) throws SwordAuthException, SwordServerException { if (authCredentials == null) { /** * in DVN 3.x at least, it seems this was never reached... eaten * somewhere by way of ServiceDocumentServletDefault -> * ServiceDocumentAPI -> SwordAPIEndpoint */ String msg = "No credentials provided."; throw new SwordAuthException(msg); } String username = authCredentials.getUsername(); if (username == null) { String msg = "No API token/key (formerly username) provided."; logger.info(msg); throw new SwordAuthException(msg); } AuthenticatedUser authenticatedUserFromToken = findUserByApiToken(username); if (authenticatedUserFromToken == null) { String msg = "User not found based on API token."; logger.fine(msg); throw new SwordAuthException(msg); } else { authenticatedUserFromToken = userSvc.updateLastApiUseTime(authenticatedUserFromToken); return authenticatedUserFromToken; } }
String un = authCredentials.getUsername() != null ? authCredentials.getUsername() : "NONE"; String obo = authCredentials.getOnBehalfOf() != null ?
String un = authCredentials.getUsername() != null ? authCredentials.getUsername() : "NONE"; String obo = authCredentials.getOnBehalfOf() != null ?
throws SwordAuthException, SwordError, DSpaceSwordException { String obo = auth.getOnBehalfOf(); String un = auth.getUsername(); String pw = auth.getPassword();