Package net.yacy.search

Examples of net.yacy.search.Switchboard.verifyAuthentication()


        // if the url is given as clear text, the user must be authorized as admin
        // the license can be used also from non-authorized users

        String urlString = post.get("url", "");
        final String urlLicense = post.get("code", "");
        final boolean auth = (header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header); // handle access rights

        DigestURI url = null;
        if ((urlString.length() > 0) && (auth)) try {
            url = new DigestURI(urlString);
        } catch (final MalformedURLException e1) {
View Full Code Here


        final serverObjects prop = new serverObjects();
        final Switchboard sb = (Switchboard) env;


        if (post != null) {
            if (!sb.verifyAuthentication(header)) {
                // force log-in
                prop.put("AUTHENTICATE", "admin log-in");
                return prop;
            }
View Full Code Here

        final boolean showScore = ((post != null) && (post.containsKey("score")));

        // access control
        final boolean publicPage = sb.getConfigBool("publicSurftips", true);
        final boolean authorizedAccess = sb.verifyAuthentication(header);

        if ((publicPage) || (authorizedAccess)) {

            // read voting
            String hash;
View Full Code Here

        if ((publicPage) || (authorizedAccess)) {

            // read voting
            String hash;
            if ((post != null) && ((hash = post.get("voteNegative", null)) != null)) {
                if (!sb.verifyAuthentication(header)) {
                    prop.put("AUTHENTICATE", "admin log-in"); // force log-in
                    return prop;
                }
                // make new news message with voting
                if (!sb.isRobinsonMode()) {
View Full Code Here

                    map.put("refid", post.get("refid", ""));
                    sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_SURFTIPP_VOTE_ADD, map);
                }
            }
            if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {
                if (!sb.verifyAuthentication(header)) {
                    prop.put("AUTHENTICATE", "admin log-in"); // force log-in
                    return prop;
                }
                // make new news message with voting
                final HashMap<String, String> map = new HashMap<String, String>();
View Full Code Here

                    percent=(int)((float)used/(float)limit*100);
                prop.put("logged-in_limit_percent", percent/3);
                prop.put("logged-in_limit_percent2", (100-percent)/3);
            }
        //logged in via static Password
        }else if(sb.verifyAuthentication(requestHeader)){
            prop.put("logged-in", "2");
        //identified via form-login
        //TODO: this does not work for a static admin, yet.
        }else if(post != null && post.containsKey("username") && post.containsKey("password")){
          if (post.containsKey("returnto"))
View Full Code Here

public class YMarks {
  public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
        final serverObjects prop = new serverObjects();
        final UserDB.Entry user = sb.userDB.getUser(header);
        final boolean isAdmin = (sb.verifyAuthentication(header));
        final boolean isAuthUser = user!= null && user.hasRight(UserDB.AccessRight.BOOKMARK_RIGHT);

        if(isAdmin || isAuthUser) {
          prop.put("login", 1);
          final String bmk_user = (isAuthUser ? user.getUserName() : YMarkTables.USER_ADMIN);
View Full Code Here

    }

    public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
        final serverObjects prop = new serverObjects();
        boolean hasRights = sb.verifyAuthentication(header);

        prop.put("mode_admin", hasRights ? "1" : "0");

        if (post == null) {
            post = new serverObjects();
View Full Code Here

    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
        final serverObjects prop = new serverObjects();
        BlogBoard.BlogEntry page = null;

        boolean hasRights = sb.verifyAuthentication(header);

        //final int display = (hasRights || post == null) ? 1 : post.getInt("display", 0);
        //prop.put("display", display);
        prop.put("display", 1); // Fixed to 1
View Full Code Here

        prop.put("info", "0"); //no information submitted

        final String requestIP = post.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");

        // handle access rights
        if (!sb.verifyAuthentication(header)) {
            Log.logInfo("STEERING", "log-in attempt for steering from " + requestIP);
            prop.put("AUTHENTICATE", "admin log-in"); // force log-in
            return prop;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.