001    package com.nimbusds.jwt;
002    
003    
004    import java.util.Map;
005    
006    import net.minidev.json.JSONObject;
007    
008    
009    /**
010     * Read-only view of a {@link JWTClaimsSet}.
011     *
012     * @author Vladimir Dzhuvinov
013     * @version $version$ (2013-01-15)
014     */
015    public interface ReadOnlyJWTClaimsSet {
016    
017    
018            /**
019             * Gets the issuer ({@code iss}) claim.
020             *
021             * @return The issuer claim, {@code null} if not specified.
022             */
023            public String getIssuerClaim();
024    
025    
026            /**
027             * Gets the subject ({@code sub}) claim.
028             *
029             * @return The subject claim, {@code null} if not specified.
030             */
031            public String getSubjectClaim();
032            
033            
034            /**
035             * Gets the audience ({@code aud}) clam.
036             *
037             * @return The audience claim, {@code null} if not specified.
038             */
039            public String[] getAudienceClaim();
040    
041    
042            /**
043             * Gets the expiration time ({@code exp}) claim.
044             *
045             * @return The expiration time, -1 if not specified.
046             */
047            public long getExpirationTimeClaim();
048            
049            
050            /**
051             * Gets the not-before ({@code nbf}) claim.
052             *
053             * @return The not-before claim, -1 if not specified.
054             */
055            public long getNotBeforeClaim();
056            
057            
058            /**
059             * Gets the issued-at ({@code iat}) claim.
060             *
061             * @return The issued-at claim, -1 if not specified.
062             */
063            public long getIssuedAtClaim();
064            
065            
066            /**
067             * Gets the JWT ID ({@code jti}) claim.
068             *
069             * @return The JWT ID claim, {@code null} if not specified.
070             */
071            public String getJWTIDClaim();
072            
073            
074            /**
075             * Gets the type ({@code typ}) claim.
076             *
077             * @return The type claim, {@code null} if not specified.
078             */
079            public String getTypeClaim();
080            
081            
082            /**
083             * Gets a custom (non-reserved) claim.
084             * 
085             * @param name The name of the custom claim. Must not be {@code null}.
086             *
087             * @return The value of the custom claim, {@code null} if not specified.
088             */
089            public Object getCustomClaim(final String name);
090            
091            
092            /**
093             * Gets the custom (non-reserved) claims.
094             *
095             * @return The custom claims, as a unmodifiable map, empty map if none.
096             */
097            public Map<String,Object> getCustomClaims();
098             
099             
100            /**
101             * Returns the JSON object representation of the claims set.
102             *
103             * @return The JSON object representation.
104             */
105            public JSONObject toJSONObject();
106    }