mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-12 21:33:30 +00:00
AbstractAuthenticationToken.getName() now returns username alone if UserDetails present.
This commit is contained in:
parent
54ccbf5617
commit
d169829f27
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2004 Acegi Technology Pty Limited
|
/* Copyright 2004, 2005 Acegi Technology Pty Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -16,6 +16,7 @@
|
|||||||
package net.sf.acegisecurity.providers;
|
package net.sf.acegisecurity.providers;
|
||||||
|
|
||||||
import net.sf.acegisecurity.Authentication;
|
import net.sf.acegisecurity.Authentication;
|
||||||
|
import net.sf.acegisecurity.UserDetails;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +39,10 @@ public abstract class AbstractAuthenticationToken implements Authentication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
if (this.getPrincipal() instanceof UserDetails) {
|
||||||
|
return ((UserDetails) this.getPrincipal()).getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
return this.getPrincipal().toString();
|
return this.getPrincipal().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<release version="0.9.0" date="In CVS">
|
<release version="0.9.0" date="In CVS">
|
||||||
<action dev="benalex" type="update">AnonymousProcessingFilter offers protected method to control when it should execute</action>
|
<action dev="benalex" type="update">AnonymousProcessingFilter offers protected method to control when it should execute</action>
|
||||||
|
<action dev="benalex" type="fix">AbstractAuthenticationToken.getName() now returns username alone if UserDetails present</action>
|
||||||
<action dev="raykrueger" type="update">AuthorityGranter.grant now returns a java.util.Set of role names, instead of a single role name</action>
|
<action dev="raykrueger" type="update">AuthorityGranter.grant now returns a java.util.Set of role names, instead of a single role name</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="0.8.2" date="2005-04-20">
|
<release version="0.8.2" date="2005-04-20">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user