@Override public String toString() { return "LogonFixture [user: " + getUsername() + ", roles: " + getRoles() + "]"; }
public LogonFixture(final String username, final String... roles) { this(username, asList(roles)); }
public AuthenticationRequestExploration(LogonFixture logonFixture) { super(logonFixture != null? logonFixture.getUsername(): EXPLORATION_USER); this.logonFixture = logonFixture; }
@Override public List<String> getRoles() { return logonFixture!=null? logonFixture.getRoles(): super.getRoles(); }
public void switchUser(final String username, final String... roles) { getTransactionManager().endTransaction(); NakedObjectsContext.closeSession(); LogonFixture logonFixture = new LogonFixture(username, roles); AuthenticationRequestLogonFixture authRequest = new AuthenticationRequestLogonFixture(logonFixture); AuthenticationSession session = getAuthenticationManager().authenticate(authRequest); NakedObjectsContext.openSession(session); getTransactionManager().startTransaction(); }
public AuthenticationRequestLogonFixture(LogonFixture logonFixture) { this(logonFixture.getUsername(), logonFixture.getRoles()); }
private AuthenticationSession authenticateInstance(PasswordAuthenticationRequest passwordAuthenticationRequest) { if ((deploymentType.isExploring() || deploymentType.isPrototyping()) && logonFixture != null) { return new SimpleSession(logonFixture.getUsername(), logonFixture.getRoles()); } if (deploymentType.isExploring()) { return new ExplorationSession(); } return authenticationManager.authenticate(passwordAuthenticationRequest); }
session = new SimpleSession(logonFixture.getUsername(), logonFixture.getRoles()); } else { session = new ExplorationSession();
session = new SimpleSession(logonFixture.getUsername(), logonFixture.getRoles()); } else { session = new ExplorationSession();