Subject Reference Record (core/SubjectRef.java)

skillhub · server/skillhub-auth/src/main/java/com/iflytek/skillhub/auth/federation/core/SubjectRef.java · java · Apache-2.0
auth, security, lang:java, tag:identifier

An immutable identifier record for adapter-defined subject namespaces with validation. Use it to securely represent typed entity subjects in authorization systems.

// Source: https://github.com/iflytek/skillhub | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package com.iflytek.skillhub.auth.federation.core;

import java.util.Objects;

/** A case-preserving immutable identifier in an adapter-defined subject namespace. */
public record SubjectRef(SubjectType type, String value) {

    private static final int MAX_VALUE_LENGTH = 1024;

    public SubjectRef {
        Objects.requireNonNull(type, "subject type must not be null");
        Objects.requireNonNull(value, "subject value must not be null");
        if (value.isBlank()) {
            throw new IllegalArgumentException("subject value must not be blank");
        }
        if (value.len

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key