Examples of SecurityToken


Examples of org.apache.cxf.ws.security.tokenstore.SecurityToken

    private byte[] doIssuedTokenSignature(
        Token token, SupportingToken wrapper
    ) throws Exception {
        boolean tokenIncluded = false;
        // Get the issued token
        SecurityToken secTok = getSecurityToken();
        if (secTok == null) {
            LOG.fine("The retrieved SecurityToken was null");
            throw new WSSecurityException("The retrieved SecurityToken was null");
        }
       
        if (includeToken(token.getInclusion())) {
            //Add the token
            Element el = cloneElement(secTok.getToken());
            //if (securityTok != null) {
                //do we need to sign this as well?
                //String id = addWsuIdToElement(el);
                //sigParts.add(new WSEncryptionPart(id));                         
            //}
View Full Code Here

Examples of org.apache.sandesha2.security.SecurityToken

    // Check that the sender of this CloseSequence holds the correct token
    if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(msgCtx.getConfigurationContext());
      OMElement body = msgCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(rmdBean.getSecurityTokenData());
      secManager.checkProofOfPossession(token, body, msgCtx);
    }

    if (FaultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager, false)) {
      if (log.isDebugEnabled())
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

        }
    }

    private Person getPerson(String id) {
        Person person;
        SecurityToken token = new BasicSecurityToken(null, id, null, null, null, null, null, null, null);
        try {
            person =  personService.getPerson(new UserId(UserId.Type.viewer, id), null, token).get();
        } catch (Exception e) {
            throw new RuntimeException("Unable to retrieve person", e);
        }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

        return encryptedToken;
    }

    @Override
    public SecurityToken decryptSecurityToken(String encryptedSecurityToken) throws SecurityTokenException {
        SecurityToken securityToken;

        try {
            if (logger.isTraceEnabled()) {
                logger.trace("Decrypting security token: " + encryptedSecurityToken);
            }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

    }

    @Override
    public String refreshEncryptedSecurityToken(String encryptedSecurityToken) throws SecurityTokenException {
        //Decrypt the current token
        SecurityToken securityToken = this.decryptSecurityToken(encryptedSecurityToken);

        //Make sure the person is authorized to refresh this token
        String userId = String.valueOf(userService.getAuthenticatedUser().getUsername());
        if (!securityToken.getViewerId().equalsIgnoreCase(userId)) {
            throw new SecurityTokenException("Illegal attempt by user " + userId +
                    " to refresh security token with a viewerId of " + securityToken.getViewerId());
        }

        //Create a new RegionWidget instance from it so we can use it to generate a new encrypted token
        RegionWidget regionWidget = new RegionWidgetImpl(Long.toString(securityToken.getModuleId()),
                "-1",
                new RegionImpl("-1", new PageImpl("-1", userService.getUserByUsername(securityToken.getOwnerId()).getId()), -1));

        //Create and return the newly encrypted token
        return getEncryptedSecurityToken(regionWidget, new WidgetImpl("-1", securityToken.getAppUrl()));
    }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

    public void getSecurityToken_validWidget() throws SecurityTokenException {
        expect(userService.getAuthenticatedUser()).andReturn(validPerson).anyTimes();
        expect(userService.getUserById(VALID_USER_ID)).andReturn(validPerson);
        replay(userService);

        SecurityToken securityToken = securityTokenService.getSecurityToken(validRegionWidget, validWidget);
        validateSecurityToken(securityToken);
    }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

        expect(userService.getAuthenticatedUser()).andReturn(validPerson).anyTimes();
        expect(userService.getUserById(expectedOwnerId)).andReturn(new UserImpl(expectedOwnerId, expected));
        replay(userService);

        SecurityToken securityToken = securityTokenService.getSecurityToken(validRegionWidget, validWidget);
        validateSecurityToken(securityToken, expected);
    }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

        replay(userService);

        String encryptedToken = securityTokenService.getEncryptedSecurityToken(validRegionWidget, validWidget);
        assertNotNull(encryptedToken);

        SecurityToken securityToken = securityTokenService.decryptSecurityToken(encryptedToken);
        validateSecurityToken(securityToken);
    }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

        String encryptedToken = securityTokenService.getEncryptedSecurityToken(validRegionWidget, validWidget);
        assertNotNull(encryptedToken);

        encryptedToken = securityTokenService.refreshEncryptedSecurityToken(encryptedToken);

        SecurityToken securityToken = securityTokenService.decryptSecurityToken(encryptedToken);
        validateSecurityToken(securityToken);
    }
View Full Code Here

Examples of org.apache.shindig.auth.SecurityToken

    private void testGetPersonData(Set<String> fields, String ownerId, String viewerId, String applicationId,
                                   ApplicationData applicationData, Map<String, String> expectedData) throws Exception {

        Set<UserId> userIds = new HashSet<UserId>(Arrays.asList(new UserId(UserId.Type.userId, VALID_USER_ID)));

        SecurityToken securityToken = getMockSecurityToken(ownerId, viewerId, applicationId, VALID_MODULE_ID);

        List<Person> users = Arrays.asList(validPerson);
        GroupId groupId = new GroupId(GroupId.Type.self, "@self");
        expect(personService.getPeople(userIds, groupId, null, securityToken)).andReturn(users);
        replay(personService);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.