All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.integratedmodelling.kserver.controller.components.UserManager Maven / Gradle / Ivy

There is a newer version: 0.9.10
Show newest version
package org.integratedmodelling.kserver.controller.components;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.integratedmodelling.api.auth.IUser;
import org.springframework.stereotype.Component;

/**
 * Just matches headers in requests to previously authenticated users.
 * TODO switch to proper Spring security configuration when fully understood. Matching
 * engine/server security with collaboration is likely to take too much time right now,
 * but it should be done when merging node architecture. This should work fine with modeling
 * engines.
 * 
 * @author ferdinando.villa
 *
 */
@Component
public class UserManager {

    Map users = new HashMap<>();

    public void register(IUser user) {
        users.put(user.getSecurityKey(), user);
    }

    public IUser getUser(List list) {
        if (list == null) {
            return null;
        }
        for (String h : list) {
            IUser user = users.get(h);
            if (user != null) {
                return user;
            }
        }
        return null;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy