Hello,
I have a problem with the Tapestry Security Login. The Custom Realm and
the configuration works fine on a desktop app.
But on the web it does not work. If i type in my username and password,
the custom realm loads the user, but the forwarding sends me to
MyApp/login/authentication instead of the Dashboard.
First my AppModule Service file:
@Contribute( WebSecurityManager.class )
public static void addRealms( Configuration<Realm> configuration ) {
BusmasterCustomRealm realm = new BusmasterCustomRealm();
configuration.add(realm);
public static void contributeSecurityConfiguration(
Configuration<SecurityFilterChain> configuration,
SecurityFilterChainFactory factory ) {
// /authc/** rule covers /authc , /authc?q=name /authc#anchor
urls as well
configuration.add(factory.createChain( "/authc/**" ).add(
factory.authc()).build() );
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration )
// Tynamo's tapestry-security module configuration
configuration.add( SecuritySymbols.LOGIN_URL, "/Login" );
configuration.add( SecuritySymbols.SUCCESS_URL, "/Dashboard" );
configuration.add( SymbolConstants.START_PAGE_NAME, "/Login" );
My Login class:
public class Login {
@Persist
@NotNull
@Property
private String username;
@NotNull
@Property
private String password;
@Component( id = "LoginForm" )
private Form form;
//@Inject
//private AlertManager alertManager;
void onValidateFrom() {
if ( !StrChecker.isEmpty( username ) & !StrChecker.isEmpty(
password ) ) {
UserSessionUCController usuc =
UserSessionUCController.getInstance();
I_Message msg = usuc.login( username, password );
if ( E_MessageType.SUCCESS != msg.getMessageType() ) {
form.recordError( "Invalid user name or password." );
Object onSuccess() {
return Dashboard.class;
And the login class:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<link rel="stylesheet" type="text/css"
href="${asset:style/main.css}" />
<!-- Favicon -->
<link rel="shortcut icon" href="${asset:icons/iconBM.png}" />
<title>BusmasterWeb - Login</title>
</head>
<body>
<!-- Container -->
<div id="bm-containter" class="container-fluid">
<div id="bm-logo">
<h1 id="bm-header"><a href="Dashboard"><img
src="${asset:icons/LogoRed.png}" height="64"></img></a>BusmasterWeb</h1>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="Dashboard"><span
id="bm-brand">Busmaster</span></a>
</div>
</div>
</div>
<div class="row">
<!-- Content area -->
<div id="bm-content" class="col-lg-10">
<ol class="breadcrumb">
<li class="active">
Login
</li>
</ol>
<h2>Login</h2>
<div class="container-fluid">
<t:form t:id="LoginForm" role="form" class="form-horizontal">
<div class="form-group">
<t:label for="username">Username:</t:label>
<t:textfield class="form-control" t:id="username"
name="username" placeholder="Enter username" />
</div>
<div class="form-group">
<t:label for="password">Password:</t:label>
<t:passwordfield class="form-control" t:id="password"
name="password" placeholder="Password" />
</div>
<t:submit class="btn btn-primary" value="Login" />
<span class="error"></span>
</t:form>
</div>
</div>
</div>
<!-- Footer area: contains the up arrow link as glyphicon -->
<div id="bm-footer"><a href="#top"><span id="bm-up-arrow"
class="glyphicon glyphicon-circle-arrow-up"></span><br/>Top</a></div>
</div>
</body>
</html>
Regards
Jeremias
I have a problem with the Tapestry Security Login. The Custom Realm and
the configuration works fine on a desktop app.
But on the web it does not work. If i type in my username and password,
the custom realm loads the user, but the forwarding sends me to
MyApp/login/authentication instead of the Dashboard.
First my AppModule Service file:
@Contribute( WebSecurityManager.class )
public static void addRealms( Configuration<Realm> configuration ) {
BusmasterCustomRealm realm = new BusmasterCustomRealm();
configuration.add(realm);
public static void contributeSecurityConfiguration(
Configuration<SecurityFilterChain> configuration,
SecurityFilterChainFactory factory ) {
// /authc/** rule covers /authc , /authc?q=name /authc#anchor
urls as well
configuration.add(factory.createChain( "/authc/**" ).add(
factory.authc()).build() );
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration )
// Tynamo's tapestry-security module configuration
configuration.add( SecuritySymbols.LOGIN_URL, "/Login" );
configuration.add( SecuritySymbols.SUCCESS_URL, "/Dashboard" );
configuration.add( SymbolConstants.START_PAGE_NAME, "/Login" );
My Login class:
public class Login {
@Persist
@NotNull
@Property
private String username;
@NotNull
@Property
private String password;
@Component( id = "LoginForm" )
private Form form;
//@Inject
//private AlertManager alertManager;
void onValidateFrom() {
if ( !StrChecker.isEmpty( username ) & !StrChecker.isEmpty(
password ) ) {
UserSessionUCController usuc =
UserSessionUCController.getInstance();
I_Message msg = usuc.login( username, password );
if ( E_MessageType.SUCCESS != msg.getMessageType() ) {
form.recordError( "Invalid user name or password." );
Object onSuccess() {
return Dashboard.class;
And the login class:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<link rel="stylesheet" type="text/css"
href="${asset:style/main.css}" />
<!-- Favicon -->
<link rel="shortcut icon" href="${asset:icons/iconBM.png}" />
<title>BusmasterWeb - Login</title>
</head>
<body>
<!-- Container -->
<div id="bm-containter" class="container-fluid">
<div id="bm-logo">
<h1 id="bm-header"><a href="Dashboard"><img
src="${asset:icons/LogoRed.png}" height="64"></img></a>BusmasterWeb</h1>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="Dashboard"><span
id="bm-brand">Busmaster</span></a>
</div>
</div>
</div>
<div class="row">
<!-- Content area -->
<div id="bm-content" class="col-lg-10">
<ol class="breadcrumb">
<li class="active">
Login
</li>
</ol>
<h2>Login</h2>
<div class="container-fluid">
<t:form t:id="LoginForm" role="form" class="form-horizontal">
<div class="form-group">
<t:label for="username">Username:</t:label>
<t:textfield class="form-control" t:id="username"
name="username" placeholder="Enter username" />
</div>
<div class="form-group">
<t:label for="password">Password:</t:label>
<t:passwordfield class="form-control" t:id="password"
name="password" placeholder="Password" />
</div>
<t:submit class="btn btn-primary" value="Login" />
<span class="error"></span>
</t:form>
</div>
</div>
</div>
<!-- Footer area: contains the up arrow link as glyphicon -->
<div id="bm-footer"><a href="#top"><span id="bm-up-arrow"
class="glyphicon glyphicon-circle-arrow-up"></span><br/>Top</a></div>
</div>
</body>
</html>
Regards
Jeremias