@Override public LoginContext login( Map<String,Object> authToken ) { AuthToken.clearCredentials( authToken ); return LoginContext.AUTH_DISABLED; } };
public static AnonymousContext read() { return new AnonymousContext( AccessMode.Static.READ ); }
private void assertValidScheme( Map<String,Object> token ) throws InvalidAuthTokenException { String scheme = AuthToken.safeCast( AuthToken.SCHEME_KEY, token ); if ( scheme.equals( "none" ) ) { throw invalidToken( ", scheme 'none' is only allowed when auth is disabled." ); } if ( !scheme.equals( AuthToken.BASIC_SCHEME ) ) { throw invalidToken( ", scheme '" + scheme + "' is not supported." ); } }
public static Map<String,Object> authToken( String username, String password ) { return newBasicAuthToken( username, password ); } }
private LoginContext authenticate( String username, String password ) throws InvalidAuthTokenException { AuthManager authManager = authManagerSupplier.get(); Map<String,Object> authToken = newBasicAuthToken( username, password != null ? UTF8.encode( password ) : null ); return authManager.login( authToken ); }
public static LoginContext getLoginContextFromUserPrincipal( Principal principal ) { if ( principal instanceof DelegatingPrincipal ) { return ((DelegatingPrincipal) principal).getLoginContext(); } // 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(); }
protected Transaction newTransaction() throws TransactionFailureException { transaction = kernel.beginTransaction( implicit, AnonymousContext.read() ); return transaction; }
static Map<String,Object> newCustomAuthToken( String principle, String credentials, String realm, String scheme, Map<String,Object> parameters ) { return newCustomAuthToken( principle, UTF8.encode( credentials ), realm, scheme, parameters ); }
@Override public SecurityContext authorize( ToIntFunction<String> propertyIdLookup, String dbName ) { return new SecurityContext( subject(), accessMode ); } }
static Map<String,Object> newBasicAuthToken( String username, String password, String realm ) { return newBasicAuthToken( username, UTF8.encode( password ), realm ); }
private static KernelTransaction getKernelTransaction( KernelTransactions transactions ) { return transactions.newInstance( KernelTransaction.Type.implicit, AnonymousContext.none(), 0L ); }
static Map<String,Object> newCustomAuthToken( String principle, String credentials, String realm, String scheme ) { return newCustomAuthToken( principle, UTF8.encode( credentials ), realm, scheme ); }
public static AnonymousContext full() { return new AnonymousContext( AccessMode.Static.FULL ); }
static Map<String,Object> newBasicAuthToken( String username, String password ) { return newBasicAuthToken( username, UTF8.encode( password ) ); }
public static AnonymousContext none() { return new AnonymousContext( AccessMode.Static.NONE ); }
private LoginContext login( String username, String password ) throws InvalidAuthTokenException { return authManager.login( newBasicAuthToken( username, password ) ); }
public static AnonymousContext write() { return new AnonymousContext( AccessMode.Static.WRITE ); }
public static AnonymousContext writeToken() { return new AnonymousContext( AccessMode.Static.TOKEN_WRITE ); }
public static AnonymousContext writeOnly() { return new AnonymousContext( AccessMode.Static.WRITE_ONLY ); }