[jboss-jira] [JBoss JIRA] (ELY-623) Checking for anonymous principal by name is insufficient
David Lloyd (JIRA)
issues at jboss.org
Tue Sep 20 07:51:00 EDT 2016
[ https://issues.jboss.org/browse/ELY-623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295607#comment-13295607 ]
David Lloyd commented on ELY-623:
---------------------------------
No, I disagree. It is far more useful to accept a string name. To acquire the anonymous identity, it's best to just query the security domain for it.
If we want a method which authorizes an anonymous run-as, then we'd probably just get the anonymous identity and authorize it, or else make a convenience method on SecurityDomain to do that.
> Checking for anonymous principal by name is insufficient
> --------------------------------------------------------
>
> Key: ELY-623
> URL: https://issues.jboss.org/browse/ELY-623
> Project: WildFly Elytron
> Issue Type: Bug
> Reporter: David Lloyd
> Assignee: Jan Kalina
>
> In {{src/main/java/org/wildfly/security/auth/server/SecurityIdentity.java}}:
> {noformat}
> + if (AnonymousPrincipal.getInstance().getName().equals(name)) {
> + if (! context.authorizeAnonymous(false)) {
> + throw log.runAsAuthorizationFailed(getPrincipal(), new AnonymousPrincipal(), null);
> + }
> + } else {
> + if (! (context.importIdentity(this) && context.authorize(name, authorize))) {
> + throw log.runAsAuthorizationFailed(getPrincipal(), new NamePrincipal(name), null);
> + }
> }
> {noformat}
> Only a type check is sufficient to determine if a principal is anonymous. In this fix, the string name "anonymous" takes on a special meaning for the first time, which should not be the case.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list