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

io.castle.client.internal.utils.HeaderNormalizer Maven / Gradle / Ivy

Go to download

Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users on potential account hijacks.

There is a newer version: 2.4.2
Show newest version
package io.castle.client.internal.utils;

import com.google.common.collect.ImmutableList;

import java.util.Iterator;
import java.util.List;

public class HeaderNormalizer {

    public String normalize(String headerName) {
        if (headerName == null) {
            return null;
        }
        return headerName.toLowerCase().replaceAll("_", "-");
    }


    public List normalizeList(List headers) {
        if (headers == null) {
            return null;
        }
        ImmutableList.Builder builder = ImmutableList.builder();
        for (Iterator iterator = headers.iterator(); iterator.hasNext(); ) {
            String value = iterator.next();
            builder.add(normalize(value));
        }
        return builder.build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy