Skip to content

Commit

Permalink
Use named class in SecurityContext
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Apr 16, 2018
1 parent 59fc43e commit 19ebaef
Showing 1 changed file with 23 additions and 21 deletions.
Expand Up @@ -94,30 +94,32 @@ protected String defaultString( String name )
}

/** Allows all operations. */
public static final SecurityContext AUTH_DISABLED = authDisabled( AccessMode.Static.FULL );
@SuppressWarnings( "StaticInitializerReferencesSubClass" )
public static final SecurityContext AUTH_DISABLED = new AuthDisabled( AccessMode.Static.FULL );

private static SecurityContext authDisabled( AccessMode mode )
private static class AuthDisabled extends SecurityContext
{
return new SecurityContext( AuthSubject.AUTH_DISABLED, mode )
private AuthDisabled( AccessMode mode )
{
super( AuthSubject.AUTH_DISABLED, mode );
}

@Override
public SecurityContext withMode( AccessMode mode )
{
return authDisabled( mode );
}

@Override
public String description()
{
return "AUTH_DISABLED with " + mode().name();
}

@Override
public String toString()
{
return defaultString( "auth-disabled" );
}
};
@Override
public SecurityContext withMode( AccessMode mode )
{
return new AuthDisabled( mode );
}

@Override
public String description()
{
return "AUTH_DISABLED with " + mode().name();
}

@Override
public String toString()
{
return defaultString( "auth-disabled" );
}
}
}

0 comments on commit 19ebaef

Please sign in to comment.