Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
BasicAuth.java
Go to the documentation of this file.
1/*
2 * Ollama4j - Java library for interacting with Ollama server.
3 * Copyright (c) 2025 Amith Koujalgi and contributors.
4 *
5 * Licensed under the MIT License (the "License");
6 * you may not use this file except in compliance with the License.
7 *
8*/
9package io.github.ollama4j.models.request;
10
11import java.util.Base64;
12import lombok.AllArgsConstructor;
13import lombok.Data;
14import lombok.EqualsAndHashCode;
15
16@Data
17@AllArgsConstructor
18@EqualsAndHashCode(callSuper = false)
19public class BasicAuth extends Auth {
20 private String username;
21 private String password;
22
28 public String getAuthHeaderValue() {
29 final String credentialsToEncode = this.getUsername() + ":" + this.getPassword();
30 return "Basic " + Base64.getEncoder().encodeToString(credentialsToEncode.getBytes());
31 }
32}