Skip to content
Snippets Groups Projects
  1. May 18, 2016
    • Nicholas Blair's avatar
    • Nicholas Blair's avatar
      Merge branch 'simulate-shib' into 'master' · b853d28f
      Nicholas Blair authored
      feat: Add optional REST Controller to simulate Shibboleth's session handler
      
      This pull requests adds an optional REST Controller to simulate a response that matches the exact JSON format of Shibboleth's session handler.
      
      Example: log in to https://test.my.wisc.edu. After completing login, visit https://test.my.wisc.edu/Shibboleth.sso/Session.json.
      
      This controller is not active by default; in order to add it, activate the Spring Profile named `edu.wisc.uwss.simulated-shibboleth`.
      
      Sample response for Amy Administrator:
      
      ```
      {
        expiration: 480,
        client_address: "0:0:0:0:0:0:0:1",
        protocol: "urn:oasis:names:tc:SAML:2.0:protocol",
        identity_provider: "https://logintest.wisc.edu/idp/shibboleth",
        authn_instant: "2016-05-16T17:40:37.762",
        authncontext_class: "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
        attributes: [
          {
            name: "persistent-id",
            values: [ "https://logintest.wisc.edu/idp/shibboleth!https://fake.wisc.edu/shibboleth!thisis/fake/PE="
      ]
          },
          {
            name: "uid",
            values: [ "admin" ]
          },
          {
            name: "pubcookie-user",
            values: [ "admin" ]
          },
          {
          name: "wiscEduPVI",
          values: [ "UW000A000" ]
          }
        ]
      }
      ```
      
      The idea for this came from a discussion with @levett.
      Also notify @timothy-vertein @andrew-petro 
      
      See merge request !11
      b853d28f
    • Nicholas Blair's avatar
      Merge branch 'userdetailsservice-callback' into 'master' · 54b95e3c
      Nicholas Blair authored
      feature: a callback interface allowing customization of UserDetailsService#loadUserByUsername
      
      This pull request adds a callback interface that allows downstream projects to participate in one of the core Spring Security components of the `local-users` profile: the UserDetailsService.
      
      During an authentication attempt, `UserDetailsService#loadUserByUsername` is used by Spring Security to first check if a User object exists for the username in the credentials. If no User object is found, no further credential check takes place; if a User object is found, other Spring Security components go about comparing the provided credentials in the authentication attempt to that object.
      
      We have a use case in DoIT Number that is driving the need for this. DoIT Number has a custom `UWUserDetails` class that has some additional fields stored behind a DAO. If we didn't have this customization, DoIT Number would need to sub-class `LocalUserDetailsManagerImpl`, then somehow exclude that bean from the UWSpringSecurityConfiguration - not trivially possible.
      
      The existing `LocalUserDetailsAttributesMapper` interface has a lifecycle that's not conducive to this type of request. Implementations of that interface are executed during application startup - and it is possible that the DAO may not be fully constructed at the time it's queried. We need a callback that fires at time of authentication attempt - not startup.
       
      With this pull request, DoIT Number will simply have to register a Spring Bean as follows to query that DAO and attach the necessary data to their custom `UWUserDetails` class as part of `UserDetailsService#loadUserByUsername`:
      
      ```
      @Component
      class DNumberLocalUWUserDetailsCallback implements LocalUWUserDetailsCallback<DNumberUserDetailsImpl> {
      
        @Autowired
        private ControlDao controlDao;
      
        public void success(DNumberUserDetailsImpl userDetails) {
          userDetails.setControls(controlDao.getControls(userDetails.getUsername()));
        }
      }
      ```
      
      This type of feature is only needed for `local-users` and not for `preauth`. The `PreauthenticatedUserDetailsAttributeMapper` interface has a lifecycle already similar to LocalUWUserDetailsCallback (firing on authentication attempt, not startup). 
      
      Notify @alundholm 
      
      See merge request !12
      54b95e3c
    • Nicholas Blair's avatar
      fix: remove test cruft · 1e9fbbdd
      Nicholas Blair authored
      1e9fbbdd
    • Nicholas Blair's avatar
  2. May 17, 2016
  3. May 16, 2016
  4. Mar 11, 2016
  5. Mar 09, 2016
    • Andy Summers's avatar
      Add PviAttributeBindingFilter · 98f7248f
      Andy Summers authored
      PviAttributeBindingFilter is a filter that binds the currently
      authenticated user's PVI to the request as an attribute with the key
      "wiscedupvi".
      
      Switch to Map<String, String> for attributes
      
      Using a Map allows for multiple attributes to be added to the request.
      
      Change to AttributeBindingFilter for user specific attributes
      
      Filter supports UWUserDetails style attributes (such as `wiscedupvi`) for
      adding attributes specific to an authenticated user to a request.
      
      Change to PviAttributeBindingFilter
      
      The filter only needs to add a user's PVI as an attribute.
      
      Add type check for principal
      
      Principal is not always guaranteed to be a UWUserDetails instance at the
      point it will hit this filter.
      98f7248f
  6. Mar 03, 2016
  7. Feb 29, 2016
  8. Feb 25, 2016
    • Nicholas Blair's avatar
      Merge branch 'flexible-identifiers' into 'master' · 8ff50507
      Nicholas Blair authored
      Add IdentifiersFactory for more configurable UDS UserDetailsService
      
      Defaults to same behavior (treat argument to loadUserByUsername as a NetID username), but allows for easy override with PVI and others.
      
      Use case: consider STAR. star-war supports impersonation via 'On-Behalf-Of' header. Inside the `SwitchUserOnHeaderFilter` is a reference to a `UserDetailsService`. The user attribute value of the 'On-Behalf-Of' header is passed into that `UserDetailsService#loadUserByUsername(String)` method.
      Prior to this contribution, `UdsPersonUserDetailsServiceImpl` could ONLY accept a NetID username. 
      
      This contribution defaults to that same behavior. However, if one wants to use a different user attribute, they would simply add a `@Bean` to their Spring ApplicationContext:
      
      ```java
      @Bean
      public IdentifiersFactory pviIdentifiersFactory() {
        return new IdentifiersFactory.PVI();
      }
      ```
      
      With the magic of `@Autowired(required=false)`, the default Netid configuration is replaced, and one can now pass PVIs into the `SwitchUserOnHeaderFilter`.
      
      A few other interested parties: @paul.erickson @ahoffmann @bjsousa 
      
      See merge request !6
      8ff50507
    • Nicholas Blair's avatar
      Add IdentifiersFactory for more configurable Uds UserDetailsService · 046ce483
      Nicholas Blair authored
      Defaults to same behavior (treat argument to loadUserByUsername as a NetID username), but allows for easy override with PVI and others.
      046ce483
  9. Feb 24, 2016
  10. Feb 23, 2016
  11. Feb 19, 2016
    • Nicholas Blair's avatar
      Merge branch 'documentation-improvements' into 'master' · bf106c8b
      Nicholas Blair authored
      Re-organize README, split off contribution guide
      
      This pull request is a starting point for improving the documentation prior to the upcoming brownbag.
      
      Starting with the README and contribution guide, I'll be poring over the existing docs trying to come up with examples. I'm thinking the wiki here in git.doit will be helpful as well.
      
      See merge request !4
      bf106c8b
    • Nicholas Blair's avatar
      Correct link to wiki · 8cc037af
      Nicholas Blair authored
      8cc037af
Loading