This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def user='me' | |
def pass='mypassword' | |
def ttlms=10000 | |
def id=UUID.randomUUID().toString() | |
def timeStampId= "Timestamp-${id}" | |
def tokenId="UsernameToken-${id}" | |
def fmt=ISODateTimeFormat.dateTime() | |
def created=new DateTime() | |
def writer=new StringWriter() | |
def builder=new MarkupBuilder(writer) | |
builder.'wsse:Security'('xmlns:wsse':'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd') { | |
'wsu:Timestamp'('wsu:Id':timeStampId, 'xmlns:wsu':'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd') { | |
'wsu:Created'(fmt.print(created)) | |
'wsu:Expires'(fmt.print(expires)) | |
} | |
'wsse:UsernameToken'('wsu:Id':tokenId, 'xmlns:wsu':'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd') { | |
'wsse:Username'(user) | |
'wsse:Password'(Type:'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText', pass) | |
} | |
} | |
println writer.toString() |
No comments:
Post a Comment