/** * {@inheritDoc} */ @Override public boolean isAnonymous() { if ( ( authorizedPrincipal == null ) && ( authenticatedPrincipal == null ) ) { return true; } else { return authenticatedPrincipal.getAuthenticationLevel() == AuthenticationLevel.NONE; } }
/** * {@inheritDoc} */ @Override public AuthenticationLevel getAuthenticationLevel() { return getEffectivePrincipal().getAuthenticationLevel(); }
/** * Serializes a LdapPrincipal instance. * * @param principal The LdapPrincipal instance to serialize * @param out The stream into which we will write the serialized instance * @throws IOException If the stream can't be written */ public static void serialize( LdapPrincipal principal, ObjectOutput out ) throws IOException { // The Authentication level out.writeInt( principal.getAuthenticationLevel().getLevel() ); // The principal's DN if ( principal.getDn() == null ) { Dn.EMPTY_DN.writeExternal( out ); } else { principal.getDn().writeExternal( out ); } }
/** * Creates a new instance of a DefaultCoreSession * @param principal The principal to use to process operation for this session * @param directoryService The DirectoryService to which we will send requests */ public DefaultCoreSession( LdapPrincipal principal, DirectoryService directoryService ) { this.directoryService = directoryService; authenticatedPrincipal = principal; if ( principal.getAuthenticationLevel() == AuthenticationLevel.NONE ) { anonymousPrincipal = principal; } else { anonymousPrincipal = new LdapPrincipal( directoryService.getSchemaManager() ); } // setup attribute type value objectClassAT = directoryService.getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT ); }