org.zodiac.netty.http.headers.AuthHeader Maven / Gradle / Ivy
package org.zodiac.netty.http.headers;
import java.util.Objects;
import org.zodiac.netty.http.base.Realm;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.util.AsciiString;
final class AuthHeader extends AbstractHeader {
AuthHeader() {
super(Realm.class, HttpHeaderNames.WWW_AUTHENTICATE);
}
@Override
public CharSequence toCharSequence(Realm value) {
Objects.requireNonNull(value, "value");
return AsciiString.of("Basic realm=\"" + value.toString() + "\"");
}
@Override
public Realm toValue(CharSequence value) {
Objects.requireNonNull(value, "value");
return Realm.createSimple(value);
}
}