Shiro
  1. Shiro
  2. SHIRO-38

Update JavaDoc for return type of SecurityUtils.getSubject()

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      From JavaDoc for SecurityUtils.getSubject() it is not clear what returns this method if nobody is logged in. Does it return null? or some default Subject? From Subject class documentation (getPrincipal method) I would expect that SecurityUtils.getSubject() returns some default Subject, but simple tests shows that it is not true - it returns null.
      So I would change it like this:
      @return the currently accessible <tt>Subject</tt> accessible to the calling code or null if .... (actually when?)

        Activity

        Grzegorz Borkowski created issue -
        Hide
        Grzegorz Borkowski added a comment -

        From what I see now in SecurityUtils code, I see that this method will return null if no SecurityManager or Subject is registered in ThreadContext or as VM-singleton SecurityManager - so probably this information should be put in javadoc.

        Show
        Grzegorz Borkowski added a comment - From what I see now in SecurityUtils code, I see that this method will return null if no SecurityManager or Subject is registered in ThreadContext or as VM-singleton SecurityManager - so probably this information should be put in javadoc.
        Les Hazlewood made changes -
        Field Original Value New Value
        Fix Version/s 1.0 [ 12313312 ]
        Affects Version/s 1.0 [ 12313312 ]
        Hide
        Les Hazlewood added a comment -

        I've updated the JavaDoc as well as made the code throw an IllegalStateException in the event that the method can't find the (required) SecurityManager instance. This would be an invalid configuration since the caller of SecurityUtils.getSubject() should always receive a Subject instance representing the currently executing subject, even if it is an anonymous Subject.

        Show
        Les Hazlewood added a comment - I've updated the JavaDoc as well as made the code throw an IllegalStateException in the event that the method can't find the (required) SecurityManager instance. This would be an invalid configuration since the caller of SecurityUtils.getSubject() should always receive a Subject instance representing the currently executing subject, even if it is an anonymous Subject.
        Les Hazlewood made changes -
        Assignee Les Hazlewood [ lhazlewood ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Alan Cabrera made changes -
        Affects Version/s 1.0 [ 12313312 ]
        Project JSecurity [ 12310812 ] Ki [ 12310890 ]
        Fix Version/s 1.0 [ 12313312 ]
        Component/s Documentation [ 12312413 ]
        Key JSEC-20 KI-41
        Alan Cabrera made changes -
        Fix Version/s 1.0 [ 12313690 ]
        Affects Version/s 1.0 [ 12313690 ]
        Alan Cabrera made changes -
        Component/s Documentation [ 12312677 ]
        Niclas Hedhman made changes -
        Affects Version/s 1.0 [ 12313690 ]
        Key KI-41 SHIRO-38
        Project Ki [ 12310890 ] Shiro [ 12310950 ]
        Component/s Documentation [ 12312677 ]
        Fix Version/s 1.0 [ 12313690 ]
        Hide
        Les Hazlewood added a comment -

        Closing all resolved issues due to a successful 1.0.0-incubating release

        Show
        Les Hazlewood added a comment - Closing all resolved issues due to a successful 1.0.0-incubating release
        Les Hazlewood made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Les Hazlewood
            Reporter:
            Grzegorz Borkowski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development