Package org.mitre.openid.connect.model

Examples of org.mitre.openid.connect.model.OIDCAuthenticationToken


      return null;
    }

    if (authentication instanceof OIDCAuthenticationToken) {

      OIDCAuthenticationToken token = (OIDCAuthenticationToken) authentication;

      Collection<SubjectIssuerGrantedAuthority> authorities = Lists.newArrayList(new SubjectIssuerGrantedAuthority(token.getSub(), token.getIssuer()));

      UserInfo userInfo = userInfoFetcher.loadUserInfo(token);

      if (userInfo == null) {
        // TODO: user Info not found -- error?
      } else {
        if (!Strings.isNullOrEmpty(userInfo.getSub()) && !userInfo.getSub().equals(token.getSub())) {
          // the userinfo came back and the user_id fields don't match what was in the id_token
          throw new UsernameNotFoundException("user_id mismatch between id_token and user_info call: " + token.getSub() + " / " + userInfo.getSub());
        }
      }

      return new OIDCAuthenticationToken(token.getSub(),
          token.getIssuer(),
          userInfo, authoritiesMapper.mapAuthorities(authorities),
          token.getIdTokenValue(), token.getAccessTokenValue(), token.getRefreshTokenValue());
    }

    return null;
  }
View Full Code Here


          modelAndView.addObject("userAuthorities", gson.toJson(auth.getAuthorities()));
        }

        if (p instanceof OIDCAuthenticationToken) {
          // if they're logging into this server from a remote OIDC server, pass through their user info
          OIDCAuthenticationToken oidc = (OIDCAuthenticationToken) p;
          if (oidc.getUserInfo() != null) {
            modelAndView.addObject("userInfo", oidc.getUserInfo());
            modelAndView.addObject("userInfoJson", oidc.getUserInfo().toJson());
          } else {
            modelAndView.addObject("userInfo", null);
            modelAndView.addObject("userInfoJson", "null");           
          }
        } else {
View Full Code Here

        String userId = idClaims.getSubject();

        // construct an OIDCAuthenticationToken and return a Authentication object w/the userId and the idToken

        OIDCAuthenticationToken token = new OIDCAuthenticationToken(userId, idClaims.getIssuer(), serverConfig, idTokenValue, accessTokenValue, refreshTokenValue);

        Authentication authentication = this.getAuthenticationManager().authenticate(token);

        return authentication;
      } catch (ParseException e) {
View Full Code Here

TOP

Related Classes of org.mitre.openid.connect.model.OIDCAuthenticationToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.