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

io.quarkiverse.zanzibar.DefaultUserIdExtractor Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package io.quarkiverse.zanzibar;

import java.security.Principal;
import java.util.Optional;

import jakarta.inject.Singleton;

import io.quarkus.arc.DefaultBean;

@DefaultBean
@Singleton
public class DefaultUserIdExtractor implements UserIdExtractor {

    @Override
    public Optional extractUserId(Principal principal) {
        if (principal == null || principal.getName() == null) {
            return Optional.empty();
        } else {
            return Optional.of(principal.getName());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy