public static LoginContext GetLoginContextFromUserPrincipal(Principal principal) { if (principal is DelegatingPrincipal) { return((( DelegatingPrincipal )principal).LoginContext); } // If whitelisted uris can start transactions we cannot throw exception here //throw new IllegalArgumentException( "Tried to get access mode on illegal user principal" ); return(AnonymousContext.none()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotAllowSchemaWritesInNoneMode() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotAllowSchemaWritesInNoneMode() { // Given KernelTransactionImplementation tx = newTransaction(AnonymousContext.none()); // Expect Exception.expect(typeof(AuthorizationViolationException)); // When tx.SchemaWrite(); }