001package com.nimbusds.oauth2.sdk.id;
002
003
004import net.jcip.annotations.Immutable;
005
006
007/**
008 * Subject (user) identifier.
009 */
010@Immutable
011public final class Subject extends Identifier {
012
013
014        /**
015         * Creates a new subject identifier with the specified value.
016         *
017         * @param value The subject identifier value. Must not be {@code null}
018         *              or empty string.
019         */
020        public Subject(final String value) {
021
022                super(value);
023        }
024
025
026        /**
027         * Creates a new subject identifier with a randomly generated value of 
028         * the specified byte length, Base64URL-encoded.
029         *
030         * @param byteLength The byte length of the value to generate. Must be
031         *                   greater than one.
032         */
033        public Subject(final int byteLength) {
034        
035                super(byteLength);
036        }
037        
038        
039        /**
040         * Creates a new subject identifier with a randomly generated 256-bit 
041         * (32-byte) value, Base64URL-encoded.
042         */
043        public Subject() {
044
045                super();
046        }
047
048
049        @Override
050        public boolean equals(final Object object) {
051        
052                return object instanceof Subject &&
053                       this.toString().equals(object.toString());
054        }
055}