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

com.networknt.oauth.user.handler.Oauth2UserUserIdDeleteHandler Maven / Gradle / Ivy

package com.networknt.oauth.user.handler;

import com.hazelcast.map.IMap;
import com.networknt.handler.LightHttpHandler;
import com.networknt.oauth.cache.CacheStartupHookProvider;
import com.networknt.oauth.cache.model.User;
import io.undertow.server.HttpServerExchange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Oauth2UserUserIdDeleteHandler extends UserAuditHandler implements LightHttpHandler {
    static final String USER_NOT_FOUND = "ERR12013";
    static Logger logger = LoggerFactory.getLogger(Oauth2UserUserIdDeleteHandler.class);
    @Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {
        String userId = exchange.getQueryParameters().get("userId").getFirst();
        IMap users = CacheStartupHookProvider.hz.getMap("users");
        if(users.get(userId) == null) {
            setExchangeStatus(exchange, USER_NOT_FOUND, userId);
        } else {
            users.delete(userId);
        }
        processAudit(exchange);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy