Author: angela
Date: Thu Oct 10 13:09:28 2013
New Revision: 1530963
URL: http://svn.apache.org/r1530963
Log:
OAK-1091 : TokenLoginModule#commit should throw an exception if TokenInfo is
not created
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java?rev=1530963&r1=1530962&r2=1530963&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
Thu Oct 10 13:09:28 2013
@@ -149,7 +149,7 @@ public final class TokenLoginModule exte
}
@Override
- public boolean commit() {
+ public boolean commit() throws LoginException {
if (tokenCredentials != null) {
if (!subject.isReadOnly()) {
subject.getPublicCredentials().add(tokenCredentials);
@@ -174,11 +174,14 @@ public final class TokenLoginModule exte
tc.setAttribute(name, attributes.get(name));
}
subject.getPublicCredentials().add(tc);
+ } else {
+ // failed to create token -> fail commit()
+ log.debug("TokenProvider failed to create a login token
for user " + userId);
+ throw new LoginException("Failed to create login token for
user " + userId);
}
}
}
// the login attempt on this module did not succeed: clear state
- // and check if another successful login asks for a new token to be
created.
clearState();
return false;