Package com.sun.xml.ws.api.security.secconv.client

Examples of com.sun.xml.ws.api.security.secconv.client.SCTokenConfiguration


        IssuedTokenContext ctx = null;
        //String protocol = null;
        String protocol = wssContext.getWSSCVersion(wssContext.getSecurityPolicyVersion());
        if (wssContext.isClient()) {
            SCTokenConfiguration config = new DefaultSCTokenConfiguration(protocol, scId, !wssContext.isExpired(), !wssContext.isInboundMessage());
            ctx = IssuedTokenManager.getInstance().createIssuedTokenContext(config, null);
            try {
                IssuedTokenManager.getInstance().getIssuedToken(ctx);
            } catch (WSTrustException e) {
                throw new XWSSecurityException(e);
View Full Code Here


        //IssuedTokenContext ictx = context.getIssuedTokenContext(sctPolicyId);
        IssuedTokenContext ictx = null;
        String protocol = context.getWSSCVersion(context.getSecurityPolicyVersion());
        if(context.isClient()){           
            String sctId = context.getSCPolicyIDtoSctIdMap(sctPolicyId);
            SCTokenConfiguration config = new DefaultSCTokenConfiguration(protocol, sctId, !context.isExpired(), !context.isInboundMessage());
            ictx =IssuedTokenManager.getInstance().createIssuedTokenContext(config, null);
            try{
                IssuedTokenManager.getInstance().getIssuedToken(ictx);
            }catch(WSTrustException e){
                throw new XWSSecurityException(e);
View Full Code Here

        // now get the SC ID
        String scId = token.getSCId();
        IssuedTokenContext ctx = null;       
        String protocol = context.getWSSCVersion(context.getSecurityPolicyVersion());
        if(context.isClient()){      
            SCTokenConfiguration config = new DefaultSCTokenConfiguration(protocol, scId, !context.isExpired(), !context.isInboundMessage());
            ctx =IssuedTokenManager.getInstance().createIssuedTokenContext(config, null);
            try{
                IssuedTokenManager.getInstance().getIssuedToken(ctx);
            }catch(WSTrustException e){
                throw new XWSSecurityException(e);
View Full Code Here

        IssuedTokenContext ctx = null;
        //String protocol = null;

        String protocol = context.getWSSCVersion(context.getSecurityPolicyVersion());
        if(context.isClient()){
            SCTokenConfiguration config = new DefaultSCTokenConfiguration(protocol, scId, !context.isExpired(), !context.isInboundMessage());
            ctx =IssuedTokenManager.getInstance().createIssuedTokenContext(config, null);
            try{
                IssuedTokenManager.getInstance().getIssuedToken(ctx);
            }catch(WSTrustException e){
                throw new XWSSecurityException(e);
View Full Code Here

        IssuedTokenContext ctx = null;
        //String protocol = null;
        String protocol = wssContext.getWSSCVersion(wssContext.getSecurityPolicyVersion());
        if (wssContext.isClient()) {
            SCTokenConfiguration config = new DefaultSCTokenConfiguration(protocol, scId, !wssContext.isExpired(), !wssContext.isInboundMessage());
            ctx = IssuedTokenManager.getInstance().createIssuedTokenContext(config, null);
            try {
                IssuedTokenManager.getInstance().getIssuedToken(ctx);
            } catch (WSTrustException e) {
                throw new XWSSecurityException(e);
View Full Code Here

     * IssuedTokenContext.
     */
    public void handleRSTR(
            final RequestSecurityToken rst, final RequestSecurityTokenResponse rstr, final IssuedTokenContext context) throws WSSecureConversationException {       
        if(!context.getSecurityPolicy().isEmpty()){
            SCTokenConfiguration sctConfig = (SCTokenConfiguration)context.getSecurityPolicy().get(0);
            wsscVer = WSSCVersion.getInstance(sctConfig.getProtocol());       
        }
        if(wsscVer.getNamespaceURI().equals(WSSCVersion.WSSC_13_NS_URI)){
            wsTrustVer = WSTrustVersion.WS_TRUST_13;
        }
        if (rst.getRequestType().toString().equals(wsTrustVer.getIssueRequestTypeURI())){
View Full Code Here

    private Map<String, SecurityContextTokenInfo> securityContextTokenMap
            = new HashMap<String, SecurityContextTokenInfo>();   
    private boolean tokenExpired = false;   
   
    public void issue(IssuedTokenContext ctx)throws WSTrustException{       
        SCTokenConfiguration sctConfig = (SCTokenConfiguration)ctx.getSecurityPolicy().get(0);
        if(issuedTokenContextMap.get(sctConfig.getTokenId()) != null ){
            IssuedTokenContext tmpCtx = null;
            try{
                tmpCtx = getSecurityContextToken(sctConfig.getTokenId(), sctConfig.checkTokenExpiry());
            }catch(WSSecureConversationException ex){
                if(sctConfig.isClientOutboundMessage()){
                    if(log.isLoggable(Level.FINE)){
                        log.log(Level.FINE, "SecureConversationToken expired");
                    }
                    tokenExpired = true;
                    renew(ctx);
                    tokenExpired = false;                   
                    tmpCtx = issuedTokenContextMap.get(sctConfig.getTokenId());
                }else{
                    throw new WSSecureConversationException(ex);
                }
            }
            if(tmpCtx != null){
                ctx.setCreationTime(tmpCtx.getCreationTime());
                ctx.setExpirationTime(tmpCtx.getExpirationTime());
                ctx.setProofKey(tmpCtx.getProofKey());
                ctx.setSecurityToken(tmpCtx.getSecurityToken());               
                ctx.setAttachedSecurityTokenReference(tmpCtx.getAttachedSecurityTokenReference());
                ctx.setUnAttachedSecurityTokenReference(tmpCtx.getUnAttachedSecurityTokenReference());
                if(tmpCtx.getSecurityToken() != null &&
                        ((SecurityContextToken)tmpCtx.getSecurityToken()).getInstance() != null){
                    String sctInfoKey = ((SecurityContextToken)tmpCtx.getSecurityToken()).getIdentifier().toString()+"_"+
                            ((SecurityContextToken)tmpCtx.getSecurityToken()).getInstance();                   
                    ctx.setSecurityContextTokenInfo(getSecurityContextTokenInfo(sctInfoKey));
                }
            }else{
                throw new WSTrustException("IssuedTokenContext for Token id "+sctConfig.getTokenId() +" not found in the client cache.");
            }
        }else if(!sctConfig.isClientOutboundMessage()){
            ctx.getSecurityPolicy().clear();
        }else{
            scp.process(ctx);           
            String sctId = ((SecurityContextToken)ctx.getSecurityToken()).getIdentifier().toString();
            sctConfig =  new DefaultSCTokenConfiguration((DefaultSCTokenConfiguration)sctConfig, sctId);
View Full Code Here

            addSecurityContextToken(((SecurityContextToken)ctx.getSecurityToken()).getIdentifier().toString(), ctx);
        }       
    }
   
    public void cancel(IssuedTokenContext ctx)throws WSTrustException{
        SCTokenConfiguration sctConfig = (SCTokenConfiguration)ctx.getSecurityPolicy().get(0);
        if(issuedTokenContextMap.get(sctConfig.getTokenId()) != null ){             
            scp.processCancellation(ctx);           
            clearSessionCache(sctConfig.getTokenId(), ctx);
        }           
    }
View Full Code Here

            clearSessionCache(sctConfig.getTokenId(), ctx);
        }           
    }
       
    public void renew(IssuedTokenContext ctx)throws WSTrustException{
        SCTokenConfiguration sctConfig = (SCTokenConfiguration)ctx.getSecurityPolicy().get(0);
        MessagePolicy msgPolicy = (MessagePolicy)sctConfig.getOtherOptions().get("MessagePolicy");
        if(issuedTokenContextMap.get(sctConfig.getTokenId()) != null ){
            ctx = issuedTokenContextMap.get(sctConfig.getTokenId());
            SCTokenConfiguration origSCTConfig = (SCTokenConfiguration)ctx.getSecurityPolicy().get(0);           
            if(this.tokenExpired && origSCTConfig.isRenewExpiredSCT()){
                scp.processRenew(ctx);
                String sctInfoKey = ((SecurityContextToken)ctx.getSecurityToken()).getIdentifier().toString()+"_"+
                        ((SecurityContextToken)ctx.getSecurityToken()).getInstance();               
                addSecurityContextTokenInfo(sctInfoKey, ctx.getSecurityContextTokenInfo());
            }else{
View Full Code Here

   
    private IssuedTokenContext getSecurityContextToken(String key, boolean expiryCheck) throws WSSecureConversationException{
        IssuedTokenContext ctx = issuedTokenContextMap.get(key);                       

        if (ctx != null && expiryCheck){
            SCTokenConfiguration sctConfig = (SCTokenConfiguration)ctx.getSecurityPolicy().get(0);
            String maxClockSkew  = (String)sctConfig.getOtherOptions().get(SCTokenConfiguration.MAX_CLOCK_SKEW);
           
            // Expiry check of security context token
            Calendar c = new GregorianCalendar();
            long offset = c.get(Calendar.ZONE_OFFSET);
            if (c.getTimeZone().inDaylightTime(c.getTime())) {
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.api.security.secconv.client.SCTokenConfiguration

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.